コード例 #1
0
 public void TestHusbandWifeStatic1()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     h1.Wife = w1;
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
 }
コード例 #2
0
 public void TestWifeHusbandStatic1()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     w1.Husband = h1;
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
 }
コード例 #3
0
 public void TestHusbandWifeDynamic()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     h1.MSet(Husband.WifeProperty, w1);
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
     h1.MSet(Husband.WifeProperty, null);
     Assert.AreEqual(h1.Wife, null);
     Assert.AreEqual(w1.Husband, null);
 }
コード例 #4
0
 public void TestWifeHusbandStatic2()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     w1.Husband = h1;
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
     Husband h2 = new Husband();
     w1.Husband = h2;
     Assert.AreEqual(h1.Wife, null);
     Assert.AreEqual(h2.Wife, w1);
     Assert.AreEqual(w1.Husband, h2);
 }
コード例 #5
0
 public void TestHusbandWifeStatic2()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     Wife w2 = new Wife();
     h1.Wife = w1;
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
     h1.Wife = w2;
     Assert.AreEqual(h1.Wife, w2);
     Assert.AreEqual(w1.Husband, null);
     Assert.AreEqual(w2.Husband, h1);
 }
コード例 #6
0
 public void TestWifeHusbandDynamic()
 {
     Husband h1 = new Husband();
     Wife w1 = new Wife();
     w1.MSet(Wife.HusbandProperty, h1);
     Assert.AreEqual(h1.Wife, w1);
     Assert.AreEqual(w1.Husband, h1);
     w1.MSet(Wife.HusbandProperty, null);
     Assert.AreEqual(h1.Wife, null);
     Assert.AreEqual(w1.Husband, null);
 }