public void CreateWithNullContextDoesNotThrow() { // Fixture setup var dummyRequest = new object(); var sut = new RandomCharSequenceGenerator(); // Exercise system and verify outcome Assert.DoesNotThrow(() => sut.Create(dummyRequest, null)); // Teardown }
public void SutIsSpecimenBuilder() { // Fixture setup // Exercise system var sut = new RandomCharSequenceGenerator(); // Verify outcome Assert.IsAssignableFrom<ISpecimenBuilder>(sut); // Teardown }
public void CreateWithNonTypeRequestReturnsCorrectResult(object request) { // Fixture setup var dummyContext = new DelegatingSpecimenContext(); var sut = new RandomCharSequenceGenerator(); // Exercise system var result = sut.Create(request, dummyContext); // Verify outcome var expectedResult = new NoSpecimen(request); Assert.Equal(expectedResult, result); // Teardown }
public void CreateWithCharRequestReturnsCorrectResult() { // Fixture setup var dummyContext = new DelegatingSpecimenContext(); var sut = new RandomCharSequenceGenerator(); // Exercise system var result = sut.Create(typeof(char), dummyContext); // Verify outcome Assert.IsAssignableFrom<char>(result); // Teardown }
public void CreateReturnsCorrectResultOnMultipleCallWhenRunOutOfChars( int expected, int repeatCount) { // Fixture setup var dummyContext = new DelegatingSpecimenContext(); var sut = new RandomCharSequenceGenerator(); // Exercise system var result = Enumerable .Range(1, repeatCount) .Select(x => sut.Create(typeof(char), dummyContext)) .Cast<char>() .Distinct() .Count(); // Verify outcome Assert.Equal(expected, result); // Teardown }
public void CreateReturnsCorrectResultOnMultipleCall() { // Fixture setup int printableCharactersCount = 94; char c = '!'; var expected = Enumerable .Range(1, printableCharactersCount) .Select(x => c++) .Cast<char>() .OrderBy(x => x); var dummyContext = new DelegatingSpecimenContext(); var sut = new RandomCharSequenceGenerator(); // Exercise system var result = Enumerable .Range(1, printableCharactersCount) .Select(x => sut.Create(typeof(char), dummyContext)) .Cast<char>() .OrderBy(x => x); // Verify outcome Assert.True(expected.SequenceEqual(result)); // Teardown }
public void CreateWithNonCharTypeRequestReturnsNoSpecimen(Type request) { // Fixture setup var dummyContext = new DelegatingSpecimenContext(); var sut = new RandomCharSequenceGenerator(); // Exercise system 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 }