public void CreateSeededAndCountedManyOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var seed            = TimeSpan.FromDays(3);
            var count           = 6;
            var expectedResult  = Enumerable.Range(1, count).Select(i => TimeSpan.FromHours(i));
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new FiniteSequenceRequest(new SeededRequest(typeof(TimeSpan), seed), count), r);
                return(expectedResult.Cast <object>());
            };

            var composer = new DelegatingComposer {
                OnCompose = () => specimenBuilder
            };
            // Exercise system
            var result = composer.CreateMany(seed, count);

            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result));
            // Teardown
        }
Exemplo n.º 2
0
        public void CreateManyOnPostprocessComposerReturnsCorrectResult()
        {
            // Arrange
            var expectedResult  = Enumerable.Range(1, 17).Select(i => i.ToString());
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new MultipleRequest(new SeededRequest(typeof(string), null)), r);
                return(expectedResult.Cast <object>());
            };

            var composer = new DelegatingComposer <string> {
                OnCreate = specimenBuilder.OnCreate
            };
            // Act
            var result = composer.CreateMany();

            // Assert
            Assert.True(expectedResult.SequenceEqual(result));
        }
        public void CreateManyOnPostprocessComposerReturnsCorrectResult()
        {
            // Fixture setup
            var expectedResult  = Enumerable.Range(1, 17).Select(i => i.ToString());
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new MultipleRequest(new SeededRequest(typeof(string), null)), r);
                return(expectedResult.Cast <object>());
            };

            var composer = new DelegatingComposer <string> {
                OnCompose = () => specimenBuilder
            };
            // Exercise system
            var result = composer.CreateMany();

            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result));
            // Teardown
        }
Exemplo n.º 4
0
        public void CreateCountedManyOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Arrange
            var count           = 9;
            var expectedResult  = Enumerable.Range(1, count).Select(i => i.ToString());
            var specimenBuilder = new DelegatingSpecimenBuilder();

            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new FiniteSequenceRequest(new SeededRequest(typeof(string), null), count), r);
                return(expectedResult.Cast <object>());
            };

            ISpecimenBuilder composer = new DelegatingComposer {
                OnCreate = specimenBuilder.OnCreate
            };
            // Act
            var result = composer.CreateMany <string>(count);

            // Assert
            Assert.True(expectedResult.SequenceEqual(result));
        }
Exemplo n.º 5
0
        public void CreateSeededAndCountedManyOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var seed = TimeSpan.FromDays(3);
            var count = 6;
            var expectedResult = Enumerable.Range(1, count).Select(i => TimeSpan.FromHours(i));
            var specimenBuilder = new DelegatingSpecimenBuilder();
            specimenBuilder.OnCreate = (r, c) =>
                {
                    Assert.NotNull(c);
                    Assert.Equal(new FiniteSequenceRequest(new SeededRequest(typeof(TimeSpan), seed), count), r);
                    return expectedResult.Cast<object>();
                };

            var composer = new DelegatingComposer { OnCreate = specimenBuilder.OnCreate };
            // Exercise system
            var result = composer.CreateMany(seed, count);
            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result));
            // Teardown
        }
Exemplo n.º 6
0
        public void CreateCountedManyOnPostprocessComposerReturnsCorrectResult()
        {
            // Fixture setup
            var count = 9;
            var expectedResult = Enumerable.Range(1, count).Select(i => i.ToString());
            var specimenBuilder = new DelegatingSpecimenBuilder();
            specimenBuilder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(new FiniteSequenceRequest(new SeededRequest(typeof(string), null), count), r);
                return expectedResult.Cast<object>();
            };

            var composer = new DelegatingComposer<string> { OnCreate = specimenBuilder.OnCreate };
            // Exercise system
            var result = composer.CreateMany(count);
            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result));
            // Teardown
        }
Exemplo n.º 7
0
        public void CreateManyOnSpecimenBuilderComposerReturnsCorrectResult()
        {
            // Fixture setup
            var expectedResult = Enumerable.Range(1, 17).Select(i => i.ToString());
            var specimenBuilder = new DelegatingSpecimenBuilder();
            specimenBuilder.OnCreate = (r, c) =>
                {
                    Assert.NotNull(c);
                    Assert.Equal(new MultipleRequest(new SeededRequest(typeof(string), null)), r);
                    return expectedResult.Cast<object>();
                };

            ISpecimenBuilderComposer composer = new DelegatingComposer { OnCompose = () => specimenBuilder };
            // Exercise system
            var result = composer.CreateMany<string>();
            // Verify outcome
            Assert.True(expectedResult.SequenceEqual(result));
            // Teardown
        }