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);
     }
 }
示例#2
0
 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);
     }
 }