Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

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

Packages

No packages published
You can’t perform that action at this time.