public void CreateCountedManyOnSpecimenBuilderReturnsCorrectResult()
        {
            // Arrange
            var count    = 31;
            var expected =
                Enumerable.Range(1, count).Select(i => i.ToString());
            var builder = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(
                    new FiniteSequenceRequest(
                        new SeededRequest(typeof(string), null), count),
                    r);
                return(expected.Cast <object>());
            };
            // Act
            IEnumerable <string> actual = builder.CreateMany <string>(count);

            // Assert
            Assert.True(
                expected.SequenceEqual(actual),
                "Sequences not equal.");
        }
Exemple #2
0
        public void CreateManyOnSpecimenBuilderReturnsCorrectResult()
        {
            // Fixture setup
            var expected =
                Enumerable.Range(1337, 42).Select(i => i.ToString());
            var builder = new DelegatingSpecimenBuilder();

            builder.OnCreate = (r, c) =>
            {
                Assert.NotNull(c);
                Assert.Equal(
                    new MultipleRequest(
                        new SeededRequest(typeof(string), null)),
                    r);
                return(expected.Cast <object>());
            };
            // Exercise system
            IEnumerable <string> actual = builder.CreateMany <string>();

            // Verify outcome
            Assert.True(
                expected.SequenceEqual(actual),
                "Sequences not equal.");
            // Teardown
        }
 public void CreateSeededAndCountedManyOnSpecimenBuilderReturnsCorrectResult()
 {
     // Fixture setup
     var seed = TimeSpan.FromDays(4);
     var count = 5;
     var expected =
         Enumerable.Range(1, count).Select(i => TimeSpan.FromHours(i));
     var builder = new DelegatingSpecimenBuilder();
     builder.OnCreate = (r, c) =>
     {
         Assert.NotNull(c);
         Assert.Equal(
             new FiniteSequenceRequest(
                 new SeededRequest(typeof(TimeSpan), seed), count),
             r);
         return expected.Cast<object>();
     };
     // Exercise system
     IEnumerable<TimeSpan> actual = builder.CreateMany(seed, count);
     // Verify outcome
     Assert.True(
         expected.SequenceEqual(actual),
         "Sequences not equal.");
     // Teardown
 }
 public void CreateCountedManyOnSpecimenBuilderReturnsCorrectResult()
 {
     // Fixture setup
     var count = 31;
     var expected = 
         Enumerable.Range(1, count).Select(i => i.ToString());
     var builder = new DelegatingSpecimenBuilder();
     builder.OnCreate = (r, c) =>
     {
         Assert.NotNull(c);
         Assert.Equal(
             new FiniteSequenceRequest(
                 new SeededRequest(typeof(string), null), count),
             r);
         return expected.Cast<object>();
     };
     // Exercise system
     IEnumerable<string> actual = builder.CreateMany<string>(count);
     // Verify outcome
     Assert.True(
         expected.SequenceEqual(actual),
         "Sequences not equal.");
     // Teardown
 }