Example #1
0
 public void Value_()
 {
     SigoAssert.Equal(Leafs(false), Gen("false"));
     SigoAssert.Equal(Leafs(true), Gen("true"));
     SigoAssert.Equal(Leafs(123), Gen("123"));
     SigoAssert.Equal(Leafs("abc"), Gen("'abc'"));
 }
Example #2
0
        public void Object_separator_flag(string a, string b)
        {
            var sa = SigoSchema.Parse(a);
            var sb = SigoSchema.Parse(b);

            SigoAssert.Equal(sa.Count(), sb.Count());
        }
Example #3
0
 public void Var_set_()
 {
     // make sure no other test-thread mutate the context
     lock (SigoSchema.Context) {
         Gen("money='USD'|'VND'");
         SigoAssert.Equal(2, SigoSchema.Context["money"].Count());
     }
 }
Example #4
0
        public void Object_flag_default()
        {
            var expected = new[] {
                Sigo.Create(3)
            };

            SigoAssert.Equal(expected, Gen("{ }"));
        }
Example #5
0
        public void ShouldEqual()
        {
            var a1 = Sigo.From(1);
            var a2 = Sigo.From(1);

            SigoAssert.Equal(a1, a2);
            SigoAssert.Equal(new[] { a1, a2 }, new[] { a2, a1 });
        }
Example #6
0
        public void Object_flag_()
        {
            var expected = new[] {
                Sigo.Create(0),
                Sigo.Create(3),
                Sigo.Create(7)
            };

            SigoAssert.Equal(expected, Gen("{037}"));
        }
Example #7
0
        public void Object_field_()
        {
            var expected = new[] {
                Sigo.Create(3, "x", 1),
                Sigo.Create(3, "x", 2),
                Sigo.Create(3, "x", 3)
            };

            SigoAssert.Equal(expected, Gen("{x: 1|2|3}"));
        }
Example #8
0
        public void Object_field_optional()
        {
            var expected = new[] {
                Sigo.Create(3),
                Sigo.Create(3, "x", 1),
                Sigo.Create(3, "y", 1),
                Sigo.Create(3, "x", 1, "y", 1)
            };

            SigoAssert.Equal(expected, Gen("{x?: 1, y?:1}"));
        }
Example #9
0
        public void Object_field_auto()
        {
            var expected = new[] {
                Sigo.Create(3, "money", "USD"),
                Sigo.Create(3, "money", "VND")
            };

            Gen("money='USD'|'VND'");

            SigoAssert.Equal(expected, Gen("{money}"));
        }
Example #10
0
        public void ShouldNotEqual()
        {
            var a = Sigo.From(1);
            var b = Sigo.From(2);

            SigoAssert.NotEqual(a, b);

            SigoAssert.NotEqual(new[] { a }, new[] { b });
            SigoAssert.NotEqual(new[] { a }, new[] { b });

            SigoAssert.NotEqual(new[] { b, a }, new[] { b });
            SigoAssert.NotEqual(new[] { a }, new[] { a, b });
        }
Example #11
0
        public void Statements()
        {
            var src = "number=1|2; string='aa'|'bb'; 'ok'; number|string";

            var expected = new[] {
                Sigo.From(1),
                Sigo.From(2),
                Sigo.From("aa"),
                Sigo.From("bb")
            };

            SigoAssert.Equal(expected, Gen(src));
        }
Example #12
0
        public void Object_flag_any()
        {
            var expected = new[] {
                Sigo.Create(0),
                Sigo.Create(1),
                Sigo.Create(2),
                Sigo.Create(3),
                Sigo.Create(4),
                Sigo.Create(5),
                Sigo.Create(6),
                Sigo.Create(7)
            };

            SigoAssert.Equal(expected, Gen("{?}"));
        }
Example #13
0
 public void Statements_separator(string a)
 {
     SigoAssert.Equal(Leafs(1), Gen(a));
 }
Example #14
0
 public void UniqueTest()
 {
     SigoAssert.Equal(Leafs(2, 0), SigoSchema.Parse(src).Generate(GenerateOptions.Unique));
 }
Example #15
0
 public void UniqueSortedTest()
 {
     SigoAssert.Equal(Leafs(0, 2), SigoSchema.Parse(src).Generate(GenerateOptions.UniqueSorted));
 }
Example #16
0
        public void List_()
        {
            var expected = Leafs(false, true, 123, "abc");

            SigoAssert.Equal(expected, Gen(" false | true | 123 | 'abc' "));
        }
Example #17
0
 public void Var_set_return_empty()
 {
     SigoAssert.Equal(Leafs(), Gen("money='USD'|'VND'"));
 }
Example #18
0
        public void Var_get_()
        {
            Gen("money='USD'|'VND'");

            SigoAssert.Equal(Leafs("bitcoin", "USD", "VND"), Gen("'bitcoin' | money"));
        }