Esempio 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);
        }
Esempio 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
        }
Esempio 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
        }
        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
        }
        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
        }