public void CreateFiltersOmitSpecimenInstances() { // Fixture setup var request = new object(); var count = 3; var manyRequest = new FiniteSequenceRequest(request, count); var results = new object[] { new object(), new OmitSpecimen(), new object() }; var q = new Queue <object>(results); var context = new DelegatingSpecimenContext { OnResolve = r => request.Equals(r) ? q.Dequeue() : new NoSpecimen(r) }; var sut = new StableFiniteSequenceRelay(); // Exercise system var actual = sut.Create(manyRequest, context); // Verify outcome var iter = Assert.IsAssignableFrom <IEnumerable <object> >(actual); Assert.True( results.Where(x => !(x is OmitSpecimen)).SequenceEqual(iter), "Actual sequence is not equal to expected sequence."); // Teardown }
public void CreateWithNullContextThrows() { // Arrange var sut = new StableFiniteSequenceRelay(); var dummyRequest = new object(); // Act & assert Assert.Throws <ArgumentNullException>(() => sut.Create(dummyRequest, null)); }
public void CreateWithNullContextThrows() { // Fixture setup var sut = new StableFiniteSequenceRelay(); var dummyRequest = new object(); // Exercise system and verify outcome Assert.Throws <ArgumentNullException>(() => sut.Create(dummyRequest, null)); // Teardown }
public void CreateWithInvalidRequestReturnsCorrectResult(object request) { // Arrange var sut = new StableFiniteSequenceRelay(); // Act var dummyContext = new DelegatingSpecimenContext(); var result = sut.Create(request, dummyContext); // Assert var expectedResult = new NoSpecimen(); Assert.Equal(expectedResult, result); }
public void CreateWithInvalidRequestReturnsCorrectResult(object request) { // Fixture setup var sut = new StableFiniteSequenceRelay(); // Exercise system var dummyContext = new DelegatingSpecimenContext(); var result = sut.Create(request, dummyContext); // Verify outcome var expectedResult = new NoSpecimen(request); Assert.Equal(expectedResult, result); // Teardown }
public void CreateWithAnonymousRequestReturnsCorrectResult() { // Fixture setup var sut = new StableFiniteSequenceRelay(); var request = new object(); // Exercise system var dummyContext = new DelegatingSpecimenContext(); var result = sut.Create(request, dummyContext); // Verify outcome #pragma warning disable 618 var expectedResult = new NoSpecimen(request); #pragma warning restore 618 Assert.Equal(expectedResult, result); // Teardown }
public void CreateReturnsStableSequence() { // Arrange var request = new object(); var count = 3; var manyRequest = new FiniteSequenceRequest(request, count); var context = new DelegatingSpecimenContext { OnResolve = r => request.Equals(r) ? new object() : new NoSpecimen() }; var sut = new StableFiniteSequenceRelay(); // Act var result = sut.Create(manyRequest, context); // Assert var expected = Assert.IsAssignableFrom <IEnumerable <object> >(result); Assert.True(expected.SequenceEqual(expected)); }
public void CreateReturnsStableSequence() { // Fixture setup var request = new object(); var count = 3; var manyRequest = new FiniteSequenceRequest(request, count); var context = new DelegatingSpecimenContext { OnResolve = r => request.Equals(r) ? new object() : new NoSpecimen(r) }; var sut = new StableFiniteSequenceRelay(); // Exercise system var result = sut.Create(manyRequest, context); // Verify outcome var expected = Assert.IsAssignableFrom <IEnumerable <object> >(result); Assert.True(expected.SequenceEqual(expected)); // Teardown }