Skip to content

Testing library for creating Expected Objects.

License

Notifications You must be signed in to change notification settings

pliance/expectedObjects

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExpectedObjects

Conventional Commits

ExpectedObjects is a testing library implementing the Expected Object pattern. Use of the Expected Object pattern eliminates the need to encumber system objects with test-specific equality behavior, helps to reduce test code duplication, and aids in expressing the logical intent of automated tests.

Quickstart

Installation

$> nuget install ExpectedObjects

Example Usage

using Xunit;

namespace MyProject.Specs
{
  public class CustomerServiceSpecs
  {        
    [Fact]
    public void RetrievingACustomer_ShouldReturnTheExpectedCustomer()
    {
      // Arrange
      var expectedCustomer = new Customer
      {
        FirstName = "Silence",
        LastName = "Dogood",
        Address = new Address
        {
          AddressLineOne = "The New-England Courant",
          AddressLineTwo = "3 Queen Street",
          City = "Boston",
          State = "MA",
          PostalCode = "02114"
        }                                            
      }.ToExpectedObject();


      // Act
      var actualCustomer = new CustomerService().GetCustomerByName("Silence", "Dogood");


      // Assert
      expectedCustomer.ShouldEqual(actualCustomer);
    }
  }
}

For more examples, see the documentation or browse the specifications.

About

Testing library for creating Expected Objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.5%
  • Batchfile 0.5%