public void CreateWithNullRepositoryWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); ProductRepository nullRepository = null; // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => fixture.Build<ProductService>() .FromFactory(() => new ProductService(nullRepository)) .CreateAnonymous()); // Teardown }
public void CreateWithNullBasketDiscountPolicyWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); BasketDiscountPolicy nullDiscountPolicy = null; // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => fixture.Build<BasketService>() .FromFactory((BasketRepository r) => new BasketService(r, nullDiscountPolicy)) .CreateAnonymous()); // Teardown }
public void CreateWithNullRepositoryWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); ProductRepository nullRepository = null; // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => fixture.Build <ProductService>() .FromFactory(() => new ProductService(nullRepository)) .CreateAnonymous()); // Teardown }
public void CreateWithNullOwnerWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); IPrincipal nullOwner = null; // Exercise system and verify outcome Assert.Throws<ArgumentNullException>(() => fixture.Build<Basket>() .FromFactory(() => new Basket(nullOwner)) .OmitAutoProperties() .CreateAnonymous()); // Teardown }
public void CreateWithNullBasketDiscountPolicyWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); BasketDiscountPolicy nullDiscountPolicy = null; // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => fixture.Build <BasketService>() .FromFactory((BasketRepository r) => new BasketService(r, nullDiscountPolicy)) .CreateAnonymous()); // Teardown }
public void CreateWithNullRepositoryWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); DiscountRepository nullRepository = null; // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => fixture.Build <RepositoryBasketDiscountPolicy>() .FromFactory(() => new RepositoryBasketDiscountPolicy(nullRepository)) .OmitAutoProperties() .CreateAnonymous()); // Teardown }
public void CreateWithNullOwnerWillThrow() { // Fixture setup var fixture = new RepositoryFixture(); IPrincipal nullOwner = null; // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => fixture.Build <Basket>() .FromFactory(() => new Basket(nullOwner)) .OmitAutoProperties() .CreateAnonymous()); // Teardown }
public void OwnerWillMatchConstructorArgument() { // Fixture setup var fixture = new RepositoryFixture(); var expectedOwner = fixture.CreateAnonymous<IPrincipal>(); var sut = fixture.Build<Basket>() .FromFactory(() => new Basket(expectedOwner)) .OmitAutoProperties() .CreateAnonymous(); // Exercise system IPrincipal result = sut.Owner; // Verify outcome Assert.Equal<IPrincipal>(expectedOwner, result); // Teardown }
public void OwnerWillMatchConstructorArgument() { // Fixture setup var fixture = new RepositoryFixture(); var expectedOwner = fixture.CreateAnonymous <IPrincipal>(); var sut = fixture.Build <Basket>() .FromFactory(() => new Basket(expectedOwner)) .OmitAutoProperties() .CreateAnonymous(); // Exercise system IPrincipal result = sut.Owner; // Verify outcome Assert.Equal <IPrincipal>(expectedOwner, result); // Teardown }