/// <summary> /// Compares the response of GetMetadata with the expected response. /// </summary> /// <param name="input">The metadata value of forwardedIps.</param> /// <param name="expected">The expected response of GetMetadata</param> private static void GetMetadataTest(string inputMAC, string[] inputIPs, Dictionary <PhysicalAddress, List <IPAddress> > expected) { NetworkInterfacesJson networkInterface = MetadataJsonHelpers.GetNetworkInterfacesJson(inputMAC, inputIPs); NetworkInterfacesJson[] networkInterfaces = new NetworkInterfacesJson[] { networkInterface }; GetMetadataNetworkInterfacesTest(networkInterfaces, expected); }
public static NetworkInterfacesJson GetNetworkInterfacesJson(string inputMAC = null, string[] inputIPs = null) { NetworkInterfacesJson networkInterfaces = new NetworkInterfacesJson(); networkInterfaces.MAC = inputMAC ?? "00 - 11 - 22 - 33 - 44 - 55"; networkInterfaces.ForwardedIps = inputIPs ?? new string[] { }; return(networkInterfaces); }
public void GetMetadataNetworkInterfacesTest() { string[] forwardedIps = new string[] { "1.1.1.1", "2.2.2.2" }; NetworkInterfacesJson[] networkInterfaces = new NetworkInterfacesJson[] { MetadataJsonHelpers.GetNetworkInterfacesJson("00-11-22-33-44-55", forwardedIps), }; GetMetadataNetworkInterfacesTest( input: networkInterfaces, expected: new Dictionary <PhysicalAddress, List <IPAddress> > { { PhysicalAddress.Parse("00-11-22-33-44-55"), new List <IPAddress> { IPAddress.Parse("1.1.1.1"), IPAddress.Parse("2.2.2.2") } } }); }