public void CreateWillReturnCorrectResult()
 {
     // Fixture setup
     var expectedResult = new object();
     var builder = new DelegatingSpecimenBuilder { OnCreate = (r, c) => expectedResult };
     var sut = new DefaultSpecimenContainer(builder);
     // Exercise system
     var dummyRequest = new object();
     var result = sut.Create(dummyRequest);
     // Verify outcome
     Assert.AreEqual(expectedResult, result, "Create");
     // Teardown
 }
        public void CreateWillReturnCorrectResult()
        {
            // Fixture setup
            var expectedResult = new object();
            var builder        = new DelegatingSpecimenBuilder {
                OnCreate = (r, c) => expectedResult
            };
            var sut = new DefaultSpecimenContainer(builder);
            // Exercise system
            var dummyRequest = new object();
            var result       = sut.Create(dummyRequest);

            // Verify outcome
            Assert.AreEqual(expectedResult, result, "Create");
            // Teardown
        }
        public void CreateWillInvokeBuilderWithCorrectRequest()
        {
            // Fixture setup
            var expectedRequest = new object();

            var mockVerified = false;
            var builderMock = new DelegatingSpecimenBuilder();
            builderMock.OnCreate = (r, c) =>
                {
                    Assert.AreEqual(expectedRequest, r, "Create");
                    mockVerified = true;
                    return new object();
                };

            var sut = new DefaultSpecimenContainer(builderMock);
            // Exercise system
            sut.Create(expectedRequest);
            // Verify outcome
            Assert.IsTrue(mockVerified, "Mock verification");
            // Teardown
        }
        public void CreateWillInvokeBuilderWithCorrectContainer()
        {
            // Fixture setup
            var mockVerified = false;
            var builderMock  = new DelegatingSpecimenBuilder();

            var sut = new DefaultSpecimenContainer(builderMock);

            builderMock.OnCreate = (r, c) =>
            {
                Assert.AreEqual(sut, c, "Create");
                mockVerified = true;
                return(new object());
            };
            // Exercise system
            var dummyRequest = new object();

            sut.Create(dummyRequest);
            // Verify outcome
            Assert.IsTrue(mockVerified, "Mock verification");
            // Teardown
        }