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