Code Monkey home page Code Monkey logo

nunit.asserts's Introduction

NUnit.Asserts

Set of simple libraries with common (more or less) asserts that makes Your tests more DRY!

NuGets

Install-Package NUnit.Asserts.Microsoft.Owin.Security
Install-Package NUnit.Asserts.Compare

NUnit.Asserts.Microsoft.Owin.Security

Asserts that help to examine ClaimsIdentity object

  • Checking ClaimsIdentity
ClaimsIdentityAssert.ContainsClaim(ClaimTypes.Role, "user", context.Ticket.Identity);
ClaimsIdentityAssert.DoesNotContainClaim(ClaimTypes.Role, "user", context.Ticket.Identity);

NUnit.Asserts.Compare

Couple of simple Nunit asserts that compare given objects using https://www.nuget.org/packages/CompareNETObjects/

  • Compare objects
Assert.That(actualObject, Compares.To(expected));
  • Assert object is contained in collection
Assert.That(actualObject, Compares.ToAnyIn(list));
  • Ignore property
Assert.That(actualObject, Compares.To(expected).IgnoreProperty(p => p.Some));
  • Ignore type checking
Assert.That(actualObject, Compares.To(expected).WithoutTypeChecking());
  • Compare objects with types check:
CompareAssert.AreEqual(expectedObject, actualObject);
  • Compare objects without types check:
CompareAssert.AreEquivalent(expectedObject, actualObject);
  • Compare objects without specified properties:
CompareAssert.AreEqual(expectedObject, actualObject, p => p.PropertyToIgnore, p => p.OtherPropertyToIgnore);
CompareAssert.AreEquivalent(expectedObject, actualObject, p => p.PropertyToIgnore, p => p.OtherPropertyToIgnore);
CompareAssert.AreEqual(expectedObject, actualObject, "PropertyToIgnore", "OtherPropertyToIgnore");
CompareAssert.AreEquivalent(expectedObject, actualObject, "PropertyToIgnore", "OtherPropertyToIgnore");

nunit.asserts's People

Contributors

mgibas avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jarocki76

nunit.asserts's Issues

project references exact versions of dependent assemblies, but nuget does not specify exact versions

When using in my project nunit version other than 3.4.1 and compareNetObjects other than 3.0.5 with nunit.asserts, I get such errors in runtime:
Message: System.IO.FileLoadException : Could not load file or assembly 'nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Could you not specify in your code exact versions of dependency assemblies?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.