public void TestCelesteStackPopLists()
        {
            CelesteStack.Push(new List <string>()
            {
                "test", "test1"
            });
            CelesteStack.Push(new List <float>()
            {
                5, -10, 20
            });
            CelesteStack.Push(new List <bool>()
            {
                true, true, false, false
            });
            CelesteStack.Push(new List <object>());

            Assert.AreEqual(4, CelesteStack.StackSize);
            Assert.IsTrue(CelesteStack.Pop().As <List <object> >().ValueEquals(new List <object>()
            {
            }));
            CelesteStack.Pop().As <List <bool> >().CheckOrderedListsEqual(new List <bool>()
            {
                true, true, false, false
            });
            CelesteStack.Pop().As <List <float> >().CheckOrderedListsEqual(new List <float>()
            {
                5, -10, 20
            });
            CelesteStack.Pop().As <List <string> >().CheckOrderedListsEqual(new List <string>()
            {
                "test", "test1",
            });
        }
Esempio n. 2
0
 /// <summary>
 /// Clears the stack and scopes and then adds the global scope again and sets the global scope to be the current scope.
 /// Something more custom will have to be implemented if adding to the global scope during a test and wanting to call this explicitly.
 /// </summary>
 protected void CleanUp()
 {
     CelesteStack.Clear();
     CelesteStack.Scopes.Clear();
     CelesteStack.Scopes.Add(CelesteStack.GlobalScope);
     CelesteStack.CurrentScope = CelesteStack.GlobalScope;
 }
        public void TestCelesteStackPopBooleans()
        {
            CelesteStack.Push(true);
            CelesteStack.Push(false);

            Assert.AreEqual(2, CelesteStack.StackSize);
            Assert.AreEqual(false, CelesteStack.Pop().As <bool>());
            Assert.AreEqual(true, CelesteStack.Pop().As <bool>());
        }
        public void TestCelesteStackPopNumbers()
        {
            CelesteStack.Push(5);
            CelesteStack.Push(-1.5f);

            Assert.AreEqual(2, CelesteStack.StackSize);
            Assert.AreEqual(-1.5f, CelesteStack.Pop().As <float>());
            Assert.AreEqual(5, CelesteStack.Pop().As <float>());
        }
        public void TestCelesteStackPopStrings()
        {
            CelesteStack.Push("test");
            CelesteStack.Push("");
            CelesteStack.Push("abcdefghijklmnopqrstuvwxyz");

            Assert.AreEqual(3, CelesteStack.StackSize);
            Assert.AreEqual("abcdefghijklmnopqrstuvwxyz", CelesteStack.Pop().As <string>());
            Assert.AreEqual("", CelesteStack.Pop().As <string>());
            Assert.AreEqual("test", CelesteStack.Pop().As <string>());
        }