public void GenerateReturnsStringTest() { var target = new IPAddressValueGenerator(); var actual = target.Generate(typeof(string), "IpAddress", null); actual.Should().NotBeNull(); actual.As<string>().Should().MatchRegex(@"\d+(\.\d+){3}"); }
public void GenerateReturnsIPAddressTest() { var target = new IPAddressValueGenerator(); var actual = target.Generate(typeof(IPAddress), null, null); actual.Should().NotBeNull(); actual.As<IPAddress>().GetAddressBytes().Any(x => x != 0).Should().BeTrue(); }
public void GenerateThrowsExceptionWithNullTypeTest() { var buildChain = new LinkedList<object>(); buildChain.AddFirst(Guid.NewGuid().ToString()); var target = new IPAddressValueGenerator(); Action action = () => target.Generate(null, Guid.NewGuid().ToString(), buildChain); action.ShouldThrow<ArgumentNullException>(); }
public void GenerateValidatesUnsupportedScenariosTest(Type type, string referenceName, bool supported) { var target = new IPAddressValueGenerator(); Action action = () => target.Generate(type, referenceName, null); if (supported) { action.ShouldNotThrow(); } else { action.ShouldThrow<NotSupportedException>(); } }