public void TestUserFriendlyInterface() { UserFriendlySupplier supplier = new UserFriendlySupplier(); InitPreference(supplier, "unittest {\r\n i=20\r\n s=k\r\n}\r\n"); //Query IUserFriendlyInterface if2 = (IUserFriendlyInterface)supplier.RootFolder.QueryAdapter(typeof(IUserFriendlyInterface)); IUserFriendlyInterface ifx = (IUserFriendlyInterface)supplier.RootFolder.QueryAdapter(typeof(IUserFriendlyInterface)); Assert.IsTrue(Object.ReferenceEquals(if2, ifx)); Assert.AreEqual(20, if2.i); Assert.AreEqual("k", if2.s); if2.i = 30; if2.s = "z"; _poderosaApplication.Shutdown(); Assert.AreEqual("unittest {\r\n i=30\r\n s=z\r\n}\r\n", Dump(_rootNote)); }
public void TestCloneImport() { UserFriendlySupplier supplier = new UserFriendlySupplier(); InitPreference(supplier, "unittest {\r\n i=20\r\n s=vieri\r\n}\r\n"); //Query and Snapshot IUserFriendlyInterface if1 = (IUserFriendlyInterface)supplier.RootFolder.QueryAdapter(typeof(IUserFriendlyInterface)); IPreferenceFolder cl = supplier.RootFolder.Clone(); IUserFriendlyInterface if2 = (IUserFriendlyInterface)cl.QueryAdapter(typeof(IUserFriendlyInterface)); Assert.IsTrue(if1 != if2); Assert.AreEqual(20, if2.i); Assert.AreEqual("vieri", if2.s); //値がコピーされたことを確認 if2.i = 10; Assert.AreEqual(10, if2.i); Assert.AreEqual(20, if1.i); //片方だけ変更されたことを確認 supplier.RootFolder.Import(cl); Assert.AreEqual(10, if2.i); Assert.AreEqual(10, if1.i); //インポートされたことを確認 }