Пример #1
0
        public void TestUnion()
        {
            var a = CbVal.NewUnion(new CbUnion("asd", CbVal.NewNull()));

            Assert.IsTrue(a.IsUnion);
            Assert.AreEqual(a.Union, new CbUnion("asd", CbVal.NewNull()));
        }
Пример #2
0
        public void TestObj()
        {
            var a = CbVal.NewObj(new Dictionary <string, CbVal> {
                { "asd", CbVal.NewNull() }
            });

            Assert.IsTrue(a.IsObj);
            Assert.AreEqual(a.Obj, new Dictionary <string, CbVal> {
                { "asd", CbVal.NewNull() }
            });
        }
Пример #3
0
        public void TestArr()
        {
            var a = CbVal.NewArr(new List <CbVal> {
                CbVal.NewNull()
            });

            Assert.IsTrue(a.IsArr);
            Assert.AreEqual(a.Arr, new List <CbVal> {
                CbVal.NewNull()
            });
        }
Пример #4
0
        public void TestArr4()
        {
            var code = "['asd', null]";

            Parser.RunInReader(code, code => {
                var r = Parser.ArrLoop(code).Value.Item2;
                Assert.AreEqual(new List <CbVal>()
                {
                    CbVal.NewStr("asd"), CbVal.NewNull()
                }, r);
            });
        }
Пример #5
0
        public void TestObj4()
        {
            var code = "{ a false b null }";

            Parser.RunInReader(code, code => {
                var r = Parser.ObjLoop(code).Value.Item2;
                Assert.AreEqual(new Dictionary <string, CbVal>()
                {
                    { "a", CbVal.NewBool(false) }, { "b", CbVal.NewNull() }
                }, r);
            });
        }
Пример #6
0
        public void TestNull()
        {
            var a = CbVal.NewNull();

            Assert.IsTrue(a.IsNull);
        }