public void CreateReturnsCorrectResultWhenSpecificationIsNotSatisfied()
 {
     // Fixture setup
     var spec = new DelegatingRequestSpecification { OnIsSatisfiedBy = r => false };
     var dummyBuilder = new DelegatingSpecimenBuilder();
     var sut = new FilteringSpecimenBuilder(dummyBuilder, spec);
     var request = new object();
     // Exercise system            
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(request, dummyContainer);
     // Verify outcome
     var expectedResult = new NoSpecimen(request);
     Assert.Equal(expectedResult, result);
     // Teardown
 }
        public void SpecificationReceivesCorrectRequest()
        {
            // Fixture setup
            var expectedRequest = new object();
            var verified = false;
            var specMock = new DelegatingRequestSpecification { OnIsSatisfiedBy = r => verified = expectedRequest == r };

            var dummyBuilder = new DelegatingSpecimenBuilder();
            var sut = new FilteringSpecimenBuilder(dummyBuilder, specMock);
            // Exercise system
            var dummyContainer = new DelegatingSpecimenContext();
            sut.Create(expectedRequest, dummyContainer);
            // Verify outcome
            Assert.True(verified, "Mock verified");
            // Teardown
        }
 public void CreatePassesCorrectParametersToDecoratedBuilder()
 {
     // Fixture setup
     var expectedRequest = new object();
     var expectedContainer = new DelegatingSpecimenContext();
     var verified = false;
     var builderMock = new DelegatingSpecimenBuilder { OnCreate = (r, c) => verified = r == expectedRequest && c == expectedContainer };
     var spec = new DelegatingRequestSpecification { OnIsSatisfiedBy = r => true };
     var sut = new FilteringSpecimenBuilder(builderMock, spec);
     // Exercise system
     sut.Create(expectedRequest, expectedContainer);
     // Verify outcome
     Assert.True(verified, "Mock verified");
     // Teardown
 }
 public void CreateReturnsCorrectResultWhenFilterAllowsRequestThrough()
 {
     // Fixture setup
     var expectedResult = new object();
     var spec = new DelegatingRequestSpecification { OnIsSatisfiedBy = r => true };
     var builder = new DelegatingSpecimenBuilder { OnCreate = (r, c) => expectedResult };
     var sut = new FilteringSpecimenBuilder(builder, spec);
     // Exercise system
     var dummyRequest = new object();
     var dummyContainer = new DelegatingSpecimenContext();
     var result = sut.Create(dummyRequest, dummyContainer);
     // Verify outcome
     Assert.Equal(expectedResult, result);
     // Teardown
 }