public void TestUpdateNetworkInfo()
        {
            vf.accessUpdateNetworkInfo(nics);

            // Check Nic1 xenstore Nic info
            // Check Name
            MockXenStoreItem name = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/1/name") as MockXenStoreItem;

            Assert.AreEqual("Ethernet UT1", name.value);
            // Check Mac
            MockXenStoreItem mac = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/1/mac") as MockXenStoreItem;

            Assert.AreEqual(UTFunctions.getMacString(mac1), mac.value);
            // Check ipv4
            MockXenStoreItem ipv4       = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/1/ipv4/0") as MockXenStoreItem;
            string           ipv4Expect = string.Format("{0:d}.{1:d}.{2:d}.{3:d}", ipv4BytesNic1[0], ipv4BytesNic1[1], ipv4BytesNic1[2], ipv4BytesNic1[3]);

            Assert.AreEqual(ipv4Expect, ipv4.value);
            // Check ipv6
            MockXenStoreItem ipv6         = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/1/ipv6/0") as MockXenStoreItem;
            string           expectedIpv6 = getIpv6String(ipv6BytesNic1);

            Assert.AreEqual(expectedIpv6, ipv6.value);

            // Check Nic2 xenstore Nic info
            // Check Name
            name = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/2/name") as MockXenStoreItem;
            Assert.AreEqual("Ethernet UT2", name.value);
            // Check Mac
            mac = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/2/mac") as MockXenStoreItem;
            Assert.AreEqual(UTFunctions.getMacString(mac2), mac.value);
            // Check ipv4
            ipv4       = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/2/ipv4/0") as MockXenStoreItem;
            ipv4Expect = string.Format("{0:d}.{1:d}.{2:d}.{3:d}", ipv4BytesNic2[0], ipv4BytesNic2[1], ipv4BytesNic2[2], ipv4BytesNic2[3]);
            Assert.AreEqual(ipv4Expect, ipv4.value);
            // Check ipv6
            ipv6         = session.GetXenStoreItem("xenserver/attr/net-sriov-vf/2/ipv6/0") as MockXenStoreItem;
            expectedIpv6 = getIpv6String(ipv6BytesNic2);
            Assert.AreEqual(expectedIpv6, ipv6.value);
        }
        /// <summary>
        /// Constructor, construct the VIfInfo object, NIC object, Session object
        /// </summary>
        public VifInfoTester()
        {
            //  arr = new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 };
            mac1 = new byte[] { 0x32, 0x70, 0xd5, 0xa0, 0x5a, 0x21 };
            mac2 = new byte[] { 0x06, 0x49, 0xdf, 0xd0, 0xbb, 0x2b };

            session = new MockWmiSession();
            // Init mock session
            session.GetXenStoreItem("xenserver/device/net-sriov-vf", "");
            session.GetXenStoreItem("xenserver/device/net-sriov-vf/1", "");
            session.GetXenStoreItem("xenserver/device/net-sriov-vf/1/mac", UTFunctions.getMacString(mac1));
            session.GetXenStoreItem("xenserver/device/net-sriov-vf/2", "");
            session.GetXenStoreItem("xenserver/device/net-sriov-vf/2/mac", UTFunctions.getMacString(mac2));
            vf = new MockVifInfo(null, session);

            // Construct mock Nics info
            nics = new MockNetworkInterface[2];
            // Construct first Nic
            nics[0]       = new MockNetworkInterface("Ethernet UT1", "This is mock NIC for UT1");
            ipv4BytesNic1 = new byte[] { 10, 71, 153, 8 };
            IPAddress addrIpv4 = new IPAddress(ipv4BytesNic1);

            ipv6BytesNic1 = new byte[] { 0xfd, 0x06, 0x77, 0x68, 0xb9, 0xe5, 0x8a, 0x40, 0x4, 0x49, 0xdf, 0xff, 0xfe, 0xd0, 0xbb, 0x2b };
            IPAddress addrIpv6 = new IPAddress(ipv6BytesNic1);

            PhysicalAddress physicalAddr = new PhysicalAddress(mac1);

            nics[0].SetPhysicalAddress(physicalAddr);


            MockUnicastIPAddressInformationCollection uniIPCol = new MockUnicastIPAddressInformationCollection();

            MockIPAddressInformation ipv4AddressInformation = new MockIPAddressInformation();

            ipv4AddressInformation.SetIPAddress(addrIpv4);

            MockIPAddressInformation ipv6AddressInformation = new MockIPAddressInformation();

            ipv6AddressInformation.SetIPAddress(addrIpv6);

            uniIPCol.Add(ipv4AddressInformation);
            uniIPCol.Add(ipv6AddressInformation);

            MockIPInterfaceProperties nicProperties = new MockIPInterfaceProperties(uniIPCol);

            nics[0].SetIPProperties(nicProperties);

            //Construct second Nic
            nics[1]       = new MockNetworkInterface("Ethernet UT2", "This is mock NIC for UT2");
            ipv4BytesNic2 = new byte[] { 10, 71, 153, 9 };
            addrIpv4      = new IPAddress(ipv4BytesNic2);
            ipv6BytesNic2 = new byte[] { 0xfd, 0x06, 0x77, 0x68, 0xb9, 0xe5, 0x8a, 0x40, 0x04, 0x49, 0xdf, 0xff, 0xfe, 0xd0, 0xbb, 0xbb };
            addrIpv6      = new IPAddress(ipv6BytesNic2);

            uniIPCol = new MockUnicastIPAddressInformationCollection();

            ipv4AddressInformation = new MockIPAddressInformation();
            ipv4AddressInformation.SetIPAddress(addrIpv4);

            ipv6AddressInformation = new MockIPAddressInformation();
            ipv6AddressInformation.SetIPAddress(addrIpv6);

            uniIPCol.Add(ipv4AddressInformation);
            uniIPCol.Add(ipv6AddressInformation);

            nicProperties = new MockIPInterfaceProperties(uniIPCol);
            nics[1].SetIPProperties(nicProperties);

            physicalAddr = new PhysicalAddress(mac2);
            nics[1].SetPhysicalAddress(physicalAddr);
        }