コード例 #1
0
ファイル: SolutionTests.cs プロジェクト: zcf7822/monodevelop
        public async Task SolutionUnboundWhenUnloadingProject()
        {
            var sol = new Solution();

            var item = new SomeItem();

            item.Name = "SomeItem";
            Assert.AreEqual(0, item.BoundEvents);
            Assert.AreEqual(0, item.UnboundEvents);

            sol.RootFolder.AddItem(item);
            Assert.AreEqual(1, item.BoundEvents);
            Assert.AreEqual(0, item.UnboundEvents);
            Assert.AreEqual(1, item.InternalItem.BoundEvents);
            Assert.AreEqual(0, item.InternalItem.UnboundEvents);

            Assert.IsTrue(item.Enabled);

            item.Reset();

            item.Enabled = false;
            await item.ParentFolder.ReloadItem(Util.GetMonitor(), item);

            SolutionItem reloadedItem = sol.GetAllItems <SolutionItem> ().FirstOrDefault(it => it.Name == "SomeItem");

            Assert.IsNotNull(reloadedItem);
            Assert.IsFalse(reloadedItem.Enabled);
            Assert.IsInstanceOf <UnloadedSolutionItem> (reloadedItem);
            Assert.AreEqual(0, item.BoundEvents);
            Assert.AreEqual(1, item.UnboundEvents);
            Assert.AreEqual(0, item.InternalItem.BoundEvents);
            Assert.AreEqual(1, item.InternalItem.UnboundEvents);

            sol.Dispose();
        }
コード例 #2
0
ファイル: SolutionTests.cs プロジェクト: zcf7822/monodevelop
 public void Reset()
 {
     BoundEvents = UnboundEvents = 0;
     if (InternalItem != null)
     {
         InternalItem.Reset();
     }
 }
コード例 #3
0
ファイル: SolutionTests.cs プロジェクト: zcf7822/monodevelop
        public void SolutionBoundUnbound()
        {
            Solution sol = new Solution();

            var e = new SomeItem();

            Assert.AreEqual(0, e.BoundEvents);
            Assert.AreEqual(0, e.UnboundEvents);

            sol.RootFolder.AddItem(e);
            Assert.AreEqual(1, e.BoundEvents);
            Assert.AreEqual(0, e.UnboundEvents);
            Assert.AreEqual(1, e.InternalItem.BoundEvents);
            Assert.AreEqual(0, e.InternalItem.UnboundEvents);

            e.Reset();
            sol.RootFolder.Items.Remove(e);
            Assert.AreEqual(0, e.BoundEvents);
            Assert.AreEqual(1, e.UnboundEvents);
            Assert.AreEqual(0, e.InternalItem.BoundEvents);
            Assert.AreEqual(1, e.InternalItem.UnboundEvents);

            e.Reset();
            sol.RootFolder.AddItem(e);
            Assert.AreEqual(1, e.BoundEvents);
            Assert.AreEqual(0, e.UnboundEvents);
            Assert.AreEqual(1, e.InternalItem.BoundEvents);
            Assert.AreEqual(0, e.InternalItem.UnboundEvents);

            e.Reset();
            sol.RootFolder.Items.Remove(e);
            Assert.AreEqual(0, e.BoundEvents);
            Assert.AreEqual(1, e.UnboundEvents);
            Assert.AreEqual(0, e.InternalItem.BoundEvents);
            Assert.AreEqual(1, e.InternalItem.UnboundEvents);

            e.Reset();
            var f = new SolutionFolder();

            f.AddItem(e);
            Assert.AreEqual(0, e.BoundEvents);
            Assert.AreEqual(0, e.UnboundEvents);
            Assert.AreEqual(0, e.InternalItem.BoundEvents);
            Assert.AreEqual(0, e.InternalItem.UnboundEvents);

            sol.RootFolder.AddItem(f);
            Assert.AreEqual(1, e.BoundEvents);
            Assert.AreEqual(0, e.UnboundEvents);
            Assert.AreEqual(1, e.InternalItem.BoundEvents);
            Assert.AreEqual(0, e.InternalItem.UnboundEvents);

            e.Reset();
            sol.RootFolder.Items.Remove(f);
            Assert.AreEqual(0, e.BoundEvents);
            Assert.AreEqual(1, e.UnboundEvents);
            Assert.AreEqual(0, e.InternalItem.BoundEvents);
            Assert.AreEqual(1, e.InternalItem.UnboundEvents);

            f.Dispose();
            sol.Dispose();
        }
コード例 #4
0
        public void SolutionBoundUnbound()
        {
            Solution sol = new Solution ();

            var e = new SomeItem ();
            Assert.AreEqual (0, e.BoundEvents);
            Assert.AreEqual (0, e.UnboundEvents);

            sol.RootFolder.AddItem (e);
            Assert.AreEqual (1, e.BoundEvents);
            Assert.AreEqual (0, e.UnboundEvents);
            Assert.AreEqual (1, e.InternalItem.BoundEvents);
            Assert.AreEqual (0, e.InternalItem.UnboundEvents);

            e.Reset ();
            sol.RootFolder.Items.Remove (e);
            Assert.AreEqual (0, e.BoundEvents);
            Assert.AreEqual (1, e.UnboundEvents);
            Assert.AreEqual (0, e.InternalItem.BoundEvents);
            Assert.AreEqual (1, e.InternalItem.UnboundEvents);

            e.Reset ();
            sol.RootFolder.AddItem (e);
            Assert.AreEqual (1, e.BoundEvents);
            Assert.AreEqual (0, e.UnboundEvents);
            Assert.AreEqual (1, e.InternalItem.BoundEvents);
            Assert.AreEqual (0, e.InternalItem.UnboundEvents);

            e.Reset ();
            sol.RootFolder.Items.Remove (e);
            Assert.AreEqual (0, e.BoundEvents);
            Assert.AreEqual (1, e.UnboundEvents);
            Assert.AreEqual (0, e.InternalItem.BoundEvents);
            Assert.AreEqual (1, e.InternalItem.UnboundEvents);

            e.Reset ();
            var f = new SolutionFolder ();
            f.AddItem (e);
            Assert.AreEqual (0, e.BoundEvents);
            Assert.AreEqual (0, e.UnboundEvents);
            Assert.AreEqual (0, e.InternalItem.BoundEvents);
            Assert.AreEqual (0, e.InternalItem.UnboundEvents);

            sol.RootFolder.AddItem (f);
            Assert.AreEqual (1, e.BoundEvents);
            Assert.AreEqual (0, e.UnboundEvents);
            Assert.AreEqual (1, e.InternalItem.BoundEvents);
            Assert.AreEqual (0, e.InternalItem.UnboundEvents);

            e.Reset ();
            sol.RootFolder.Items.Remove (f);
            Assert.AreEqual (0, e.BoundEvents);
            Assert.AreEqual (1, e.UnboundEvents);
            Assert.AreEqual (0, e.InternalItem.BoundEvents);
            Assert.AreEqual (1, e.InternalItem.UnboundEvents);

            f.Dispose ();
            sol.Dispose ();
        }