public void UpgradeAndDowngrade() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularConnected")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "main.rs")); tracker.AddRootModule(Path.Combine(temp.DirPath, "foo.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(2, reached.Count); CollectionAssert.Contains(reached, Path.Combine(temp.DirPath, "baz.rs")); CollectionAssert.Contains(reached, Path.Combine(temp.DirPath, "bar.rs")); var res = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); tracker.UpgradeModule(Path.Combine(temp.DirPath, "baz.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs"), Path.Combine(temp.DirPath, "baz.rs")); res = tracker.DowngradeModule(Path.Combine(temp.DirPath, "baz.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); Assert.AreEqual(0, res.Orphans.Count); Assert.True(res.IsReferenced); } }
public void NonIncrRootRemoval() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularMultiRoot")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "lib.rs")); tracker.AddRootModule(Path.Combine(temp.DirPath, "foo.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(1, reached.Count); HashSet <string> orphans = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")).Orphans; Assert.AreEqual(2, orphans.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "lib.rs")); } }
public void CircularAddUnroot() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularAdd")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "main.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(0, reached.Count); HashSet <string> added = tracker.AddRootModuleIncremental(Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(added, Path.Combine(temp.DirPath, "bar.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs"), Path.Combine(temp.DirPath, "foo.rs")); var rem = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(rem.Orphans, Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(rem.Orphans, Path.Combine(temp.DirPath, "bar.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); } }
public void ExplicitlyAddUnrootExisting() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularDowngrade")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "main.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(2, reached.Count); HashSet <string> added = tracker.AddRootModuleIncremental(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(0, added.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs"), Path.Combine(temp.DirPath, "foo.rs")); var unr = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(0, unr.Orphans.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); var del = tracker.DeleteModule(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(1, del.Orphans.Count); Assert.True(del.IsReferenced); File.Delete(Path.Combine(temp.DirPath, "foo.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); } }
public void CircularAddUnroot() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularAdd")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "main.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(0, reached.Count); HashSet<string> added = tracker.AddRootModuleIncremental(Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(added, Path.Combine(temp.DirPath, "bar.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs"), Path.Combine(temp.DirPath, "foo.rs")); var rem = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(rem.Orphans, Path.Combine(temp.DirPath, "foo.rs")); CollectionAssert.Contains(rem.Orphans, Path.Combine(temp.DirPath, "bar.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); } }
public void NonIncrRootRemoval() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularMultiRoot")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "lib.rs")); tracker.AddRootModule(Path.Combine(temp.DirPath, "foo.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(1, reached.Count); HashSet<string> orphans = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")).Orphans; Assert.AreEqual(2, orphans.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "lib.rs")); } }
public void ExplicitlyAddUnrootExisting() { using (TemporaryDirectory temp = Utils.LoadResourceDirectory(@"Internal\CircularDowngrade")) { var tracker = new ModuleTracker(Path.Combine(temp.DirPath, "main.rs")); var reached = tracker.ExtractReachableAndMakeIncremental(); Assert.AreEqual(2, reached.Count); HashSet<string> added = tracker.AddRootModuleIncremental(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(0, added.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs"), Path.Combine(temp.DirPath, "foo.rs")); var unr = tracker.DowngradeModule(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(0, unr.Orphans.Count); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); var del = tracker.DeleteModule(Path.Combine(temp.DirPath, "foo.rs")); Assert.AreEqual(1, del.Orphans.Count); Assert.True(del.IsReferenced); File.Delete(Path.Combine(temp.DirPath, "foo.rs")); ModelCheck(tracker, Path.Combine(temp.DirPath, "main.rs")); } }