public void CreateWithNullRequestReturnsCorrectResult() { // Arrange var sut = new DomainNameGenerator(); var context = new DelegatingSpecimenContext(); // Act var result = sut.Create(null, context); // Assert Assert.Equal(new NoSpecimen(), result); }
public void CreateWithNullRequestReturnsCorrectResult() { // Fixture setup var sut = new DomainNameGenerator(); // Exercise system var result = sut.Create(null, null); // Verify outcome Assert.Equal(new NoSpecimen(), result); // Teardown }
public void CreateReturnsOneOfTheFictiousDomains() { // Fixture setup var sut = new DomainNameGenerator(); // Exercise system var result = sut.Create(typeof(DomainName), null); // Verify outcome var actualDomainName = Assert.IsAssignableFrom <DomainName>(result); Assert.Matches(@"example\.(com|org|net)", actualDomainName.Domain); // Teardown }
public void CreateReturnsOneOfTheFictiousDomains() { // Arrange var sut = new DomainNameGenerator(); var context = new DelegatingSpecimenContext(); // Act var result = sut.Create(typeof(DomainName), context); // Assert var actualDomainName = Assert.IsAssignableFrom <DomainName>(result); Assert.Matches(@"example\.(com|org|net)", actualDomainName.Domain); }
public void CreateWithNonDomainNameRequestReturnsCorrectResult() { // Fixture setup var nonDomainNameRequest = typeof(object); var sut = new DomainNameGenerator(); // Exercise system var result = sut.Create(nonDomainNameRequest, null); // Verify outcome #pragma warning disable 618 Assert.Equal(new NoSpecimen(nonDomainNameRequest), result); #pragma warning restore 618 // Teardown }
public void CreateManyTimesReturnsAllConfiguredFictiousDomains() { // Fixture setup var sut = new DomainNameGenerator(); var expectedDomains = new[] { "example.com", "example.net", "example.org" }.Select(x => new DomainName(x)).ToList(); // Exercise system var result = Enumerable.Range(0, 100).Select(x => sut.Create(typeof(DomainName), null)).ToList(); // Verify outcome foreach (var expectedDomain in expectedDomains) { Assert.Contains(expectedDomain, result); } // Teardown }
public void CreateManyTimesReturnsAllConfiguredFictiousDomains() { // Arrange var sut = new DomainNameGenerator(); var context = new DelegatingSpecimenContext(); var expectedDomains = new[] { "example.com", "example.net", "example.org" }.Select(x => new DomainName(x)); // Act var result = Enumerable.Range(0, 100).Select(x => sut.Create(typeof(DomainName), context)).ToList(); // Assert foreach (var expectedDomain in expectedDomains) { Assert.Contains(expectedDomain, result); } }