Exemplo n.º 1
0
        public void CreateAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Arrange
            var expectedResult  = new DateTime(2010, 5, 31, 14, 52, 19);
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(DateTime), default(DateTime)), r);
                return(expectedResult);
            };

            ISpecimenBuilder composer = new DelegatingComposer {
                OnCreate = specimenBuilder.OnCreate
            };
            // Act
            var result = composer.Create <DateTime>();

            // Assert
            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 2
0
        public void CreateOnPostprocessComposerReturnsCorrectResult()
        {
            // Fixture setup
            var expectedResult  = new DateTime(2010, 5, 31, 14, 52, 19);
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(DateTime), default(DateTime)), r);
                return(expectedResult);
            };

            var composer = new DelegatingComposer <DateTime> {
                OnCreate = specimenBuilder.OnCreate
            };
            // Exercise system
            var result = composer.Create();

            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 3
0
        public void CreateaSeededAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var seed            = new Version(1, 1);
            var expectedResult  = new Version(2, 0);
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(Version), seed), r);
                return(expectedResult);
            };

            var composer = new DelegatingComposer {
                OnCreate = specimenBuilder.OnCreate
            };
            // Exercise system
            var result = composer.Create(seed);

            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 4
0
        public void CreateaSeededAnonymousOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var seed = new Version(1, 1);
            var expectedResult = new Version(2, 0);
            var specimenBuilder = new DelegatingSpecimenBuilder();
            specimenBuilder.OnCreate = (r, c) =>
                {
                    Assert.NotNull(c);
                    Assert.Equal(new SeededRequest(typeof(Version), seed), r);
                    return expectedResult;
                };

            var composer = new DelegatingComposer { OnCreate = specimenBuilder.OnCreate };
            // Exercise system
            var result = composer.Create(seed);
            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }
Exemplo n.º 5
0
        public void CreateOnPostprocessComposerReturnsCorrectResult()
        {
            // Fixture setup
            var expectedResult = new DateTime(2010, 5, 31, 14, 52, 19);
            var specimenBuilder = new DelegatingSpecimenBuilder();
            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new SeededRequest(typeof(DateTime), default(DateTime)), r);
                return expectedResult;
            };

            var composer = new DelegatingComposer<DateTime> { OnCreate = specimenBuilder.OnCreate };
            // Exercise system
            var result = composer.Create();
            // Verify outcome
            Assert.Equal(expectedResult, result);
            // Teardown
        }