public static IPEndPoint FillIPEndPoint(this FillArgs args) { var address = args.FillIPAddress(); if (address == null) { return(null); } return(new IPEndPoint(address, args.NextByte + 20)); }
public static byte[] FillByteArray(this FillArgs args) { if (args.NextIsNull) { return(null); } var result = new byte[args.NextCollectionSize]; args.Random.NextBytes(result); return(result); }
public static IPAddress FillIPAddress(this FillArgs args) { if (args.NextIsNull) { return(null); } var bytes = new byte[4]; args.Random.NextBytes(bytes); return(new IPAddress(bytes)); }
public static BitArray FillBitArray(this FillArgs args) { if (args.NextIsNull) { return(null); } var result = new BitArray(args.NextCollectionSize); for (int i = 0; i < result.Count; ++i) { result.Set(i, args.NextBoolean); } return(result); }
public static Uri FillUri(this FillArgs args) { ArgumentAssert.IsNotNull(args, "args"); if (args.NextIsNull) { return(null); } var b = new UriBuilder(); b.Scheme = args.NextBoolean ? "http" : "https"; b.Host = Guid.NewGuid().ToString("N"); b.Port = args.NextByte + 20; return(b.Uri); }
public static Guid FillGuid(this FillArgs args) { return(Guid.NewGuid()); }