public void TestConstractor()
 {
     //WindowControlから作成。
     {
         NativeIPAddress ipadress = new NativeIPAddress(testDlg.IdentifyFromDialogId(1016));
         ipadress.EmulateChangeAddress(0, 1, 2, 3);
         byte f0 = 0, f1 = 0, f2 = 0, f3 = 0;
         ipadress.GetAddress(ref f0, ref f1, ref f2,ref f3);
         Assert.AreEqual(0, f0);
         Assert.AreEqual(1, f1);
         Assert.AreEqual(2, f2);
         Assert.AreEqual(3, f3);
     }
     //ハンドルから作成。
     {
         NativeIPAddress ipadress = new NativeIPAddress(app, testDlg.IdentifyFromDialogId(1016).Handle);
         ipadress.EmulateChangeAddress(10, 11, 12, 13);
         byte f0 = 0, f1 = 0, f2 = 0, f3 = 0;
         ipadress.GetAddress(ref f0, ref f1, ref f2, ref f3);
         Assert.AreEqual(10, f0);
         Assert.AreEqual(11, f1);
         Assert.AreEqual(12, f2);
         Assert.AreEqual(13, f3);
     }
 }
        public void TestAddressValue()
        {
            NativeIPAddress ipadress = new NativeIPAddress(testDlg.IdentifyFromDialogId(1016));

            ipadress.EmulateChangeAddress(0, 1, 2, 3);
            byte f0 = 0, f1 = 0, f2 = 0, f3 = 0;
            ipadress.GetAddress(ref f0, ref f1, ref f2, ref f3);
            Assert.AreEqual(0, f0);
            Assert.AreEqual(1, f1);
            Assert.AreEqual(2, f2);
            Assert.AreEqual(3, f3);

            //非同期でも同様の効果があることを確認。
            Async a = new Async();
            ipadress.EmulateChangeAddress(10, 11, 12, 13, a);
            while (!a.IsCompleted)
            {
                Thread.Sleep(10);
            }
            ipadress.GetAddress(ref f0, ref f1, ref f2, ref f3);
            Assert.AreEqual(10, f0);
            Assert.AreEqual(11, f1);
            Assert.AreEqual(12, f2);
            Assert.AreEqual(13, f3);
        }