public void TestRemovedRemote() { using (var apApplied = new TemporaryFlagFile("ap-applied")) using (var apUnapplied = new TemporaryFlagFile("ap-unapplied")) { var appListLocal = new AppList { Entries = { new AppEntry { InterfaceUri = FeedTest.Test1Uri, AccessPoints = new AccessPointList{ Entries ={ new MockAccessPoint { ApplyFlagPath = apApplied, UnapplyFlagPath = apUnapplied } } } } } }; TestSync(SyncResetMode.None, appListLocal, appListLocal.Clone(), new AppList()); Assert.IsFalse(apApplied.Set, "Removed access point should not be reapplied"); Assert.IsTrue(apUnapplied.Set, "Removed point should be unapplied"); } }
public void TestRemovedLocal() { using (var apApplied = new TemporaryFlagFile("ap-applied")) using (var apUnapplied = new TemporaryFlagFile("ap-unapplied")) { var appListServer = new AppList { Entries = { new AppEntry { InterfaceUri = FeedTest.Test1Uri, AccessPoints = new AccessPointList{ Entries ={ new MockAccessPoint { ApplyFlagPath = apApplied, UnapplyFlagPath = apUnapplied } } } } } }; TestSync(SyncResetMode.None, new AppList(), appListServer.Clone(), appListServer); apApplied.Set.Should().BeFalse(because: "Locally removed access point should not be reapplied"); apUnapplied.Set.Should().BeFalse(because: "Locally removed access point should not be unapplied again"); } }
public void TestRemovedRemote() { using var apApplied = new TemporaryFlagFile("ap-applied"); using var apNotApplied = new TemporaryFlagFile("ap-not-applied"); var appListLocal = new AppList { Entries = { new AppEntry { InterfaceUri = FeedTest.Test1Uri, AccessPoints = new AccessPointList{ Entries ={ new MockAccessPoint { ApplyFlagPath = apApplied, UnapplyFlagPath = apNotApplied } } } } } }; TestSync(SyncResetMode.None, appListLocal, appListLocal.Clone(), new AppList()); apApplied.Set.Should().BeFalse(because: "Removed access point should not be reapplied"); apNotApplied.Set.Should().BeTrue(because: "Removed point should be not-applied"); }
private static void TestClone(AppList appList) { var appList2 = appList.Clone(); // Ensure data stayed the same appList2.Should().Be(appList, because: "Cloned objects should be equal."); appList2.GetHashCode().Should().Be(appList.GetHashCode(), because: "Cloned objects' hashes should be equal."); appList2.Should().NotBeSameAs(appList, because: "Cloning should not return the same reference."); }
private static void TestClone(AppList appList) { var appList2 = appList.Clone(); // Ensure data stayed the same Assert.AreEqual(appList, appList2, "Cloned objects should be equal."); Assert.AreEqual(appList.GetHashCode(), appList2.GetHashCode(), "Cloned objects' hashes should be equal."); Assert.IsFalse(ReferenceEquals(appList, appList2), "Cloning should not return the same reference."); }