Esempio n. 1
0
        public void IsEqualToNull()
        {
            var helpState = Watcher <string> .Create(null);

            helpState.Update(helpState.next);
            Assert.AreEqual(false, helpState.IsChange());
            helpState.Update("none");
            Assert.AreEqual(true, helpState.IsChange());
            helpState.Update(null);
            Assert.AreEqual(true, helpState.IsChange());
            helpState.Update(helpState.next);
            Assert.AreEqual(false, helpState.IsChange());
        }
Esempio n. 2
0
 public void Setup()
 {
     for (int index = 0; index < DataUtil.Length(menus); index++)
     {
         int menu = menus[index];
         levelsPerItem.Add(1);
         for (int previous = 0; previous < index; previous++)
         {
             levelsPerItem[previous] *= menu;
         }
         menuSelected.Add(-1);
     }
     SetMenuName(menuIndex);
     inMenu = Watcher <bool> .Create(IsInMenu());
 }
Esempio n. 3
0
        public void CurrentUpdateIsChangeTo()
        {
            var helpState = Watcher <string> .Create("none");

            helpState.Update(helpState.next);
            Assert.AreEqual(false, helpState.IsChangeTo("paused"));
            Assert.AreEqual(false, helpState.IsChange());
            helpState.next = "tutor";
            helpState.Update(helpState.next);
            Assert.AreEqual(false, helpState.IsChangeTo("paused"));
            Assert.AreEqual(true, helpState.IsChange());
            helpState.next = "paused";
            helpState.Update(helpState.next);
            Assert.AreEqual(true, helpState.IsChangeTo("paused"));
            Assert.AreEqual(true, helpState.IsChange());
            helpState.Update(helpState.next);
            Assert.AreEqual(false, helpState.IsChangeTo("paused"));
            Assert.AreEqual(false, helpState.IsChange());
        }
Esempio n. 4
0
        public void UpdateIsChangeTo()
        {
            bool isInMenu        = true;
            var  isInMenuWatcher = Watcher <bool> .Create(isInMenu);

            isInMenuWatcher.Update(isInMenu);
            Assert.AreEqual(false, isInMenuWatcher.IsChangeTo(false));
            Assert.AreEqual(false, isInMenuWatcher.IsChange());
            isInMenu = false;
            Assert.AreEqual(false, isInMenuWatcher.IsChangeTo(false));
            Assert.AreEqual(false, isInMenuWatcher.IsChange());
            isInMenuWatcher.Update(isInMenu);
            Assert.AreEqual(true, isInMenuWatcher.IsChangeTo(false));
            Assert.AreEqual(true, isInMenuWatcher.IsChange());
            Assert.AreEqual(false, isInMenuWatcher.IsChangeTo(true));
            isInMenuWatcher.Setup(isInMenu);
            Assert.AreEqual(false, isInMenuWatcher.IsChangeTo(false));
            Assert.AreEqual(false, isInMenuWatcher.IsChange());
            Assert.AreEqual(false, isInMenuWatcher.IsChangeTo(true));
        }