Пример #1
0
        public void ToolBarSiteNamesShouldYieldAllSiteNames()
        {
            Assert.IsFalse(_toolBarService.ToolBarSiteNames.GetEnumerator().MoveNext());
            const string site1Name   = "site1";
            const string site2Name   = "site2";
            var          cabCommand1 = new Command();
            var          cabCommand2 = new Command();
            var          command1    = _commandService.CreateCommand(cabCommand1, "command1", null);
            var          command2    = _commandService.CreateCommand(cabCommand2, "command2", null);

            _toolBarService.AddButtonItem(site1Name, command1, null, null);
            _toolBarService.AddButtonItem(site1Name, command2, null, null);
            var item       = _toolBarService.AddButtonItem(site2Name, command1, null, null);
            var enumerator = _toolBarService.ToolBarSiteNames.GetEnumerator();

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site1", enumerator.Current);
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site2", enumerator.Current);
            Assert.IsFalse(enumerator.MoveNext());

            _toolBarService.Remove(item);
            enumerator = _toolBarService.ToolBarSiteNames.GetEnumerator();
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site1", enumerator.Current);
            Assert.IsFalse(enumerator.MoveNext());
        }