public void CreateSeededManyOnSpecimenBuilderReturnsCorrectResult() { // Fixture setup var seed = TimeSpan.FromMinutes(21); var expected = Enumerable.Range(42, 7).Select(i => TimeSpan.FromHours(i)); var builder = new DelegatingSpecimenBuilder(); builder.OnCreate = (r, c) => { Assert.NotNull(c); Assert.Equal( new MultipleRequest( new SeededRequest(typeof(TimeSpan), seed)), r); return(expected.Cast <object>()); }; // Exercise system IEnumerable <TimeSpan> actual = builder.CreateMany(seed); // Verify outcome Assert.True( expected.SequenceEqual(actual), "Sequences not equal."); // Teardown }
public void CreateSeededAndCountedManyOnSpecimenBuilderReturnsCorrectResult() { // Arrange 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>()); }; // Act IEnumerable <TimeSpan> actual = builder.CreateMany(seed, count); // Assert Assert.True( expected.SequenceEqual(actual), "Sequences not equal."); }
public void CreateSeededManyOnSpecimenBuilderComposerReturnsCorrectResult() { // Arrange var seed = TimeSpan.FromMinutes(48); var expectedResult = Enumerable.Range(1, 8).Select(i => TimeSpan.FromHours(i)); var specimenBuilder = new DelegatingSpecimenBuilder(); specimenBuilder.OnCreate = (r, c) => { Assert.NotNull(c); Assert.Equal(new MultipleRequest(new SeededRequest(typeof(TimeSpan), seed)), r); return(expectedResult.Cast <object>()); }; // var composer = new DelegatingComposer { OnCreate = specimenBuilder.OnCreate }; // Act var result = specimenBuilder.CreateMany(seed); // Assert Assert.True(expectedResult.SequenceEqual(result)); }
public void CreateSeededAndCountedManyOnSpecimenBuilderComposerReturnsCorrectResult() { // Arrange 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>()); }; // Act var result = specimenBuilder.CreateMany(seed, count); // Assert Assert.True(expectedResult.SequenceEqual(result)); }