示例#1
0
        public void Dispose()
        {
            var sm = new SourceManager();

            sm.Initialize();
            sm.AddSource(new ErrorSource("Baz"));
            Assert.IsFalse(sm.Sources.Count == 0);
            sm.Dispose();
            Assert.IsTrue(sm.Sources.Count == 0);
        }
示例#2
0
        public void AddRemove()
        {
            var sm  = new SourceManager();
            var src = new SourceManager.GroupSource("Foo", 1);

            sm.AddSource(src, false);
            Assert.IsTrue(sm.Sources.Count == 1);

            var src2 = new SourceManager.GroupSource("Bar", 2);

            sm.AddSource(src2, true);
            Assert.IsTrue(sm.Sources.Count == 2);
            Assert.AreEqual(src2, sm.DefaultSource);
            Assert.AreEqual(src2, sm.ActiveSource);

            sm.SetActiveSource(src);
            Assert.AreEqual(src, sm.ActiveSource);

            sm.RemoveSource(src);
            Assert.IsTrue(sm.Sources.Count == 1);
        }