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'")); }
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()); }
public void Object_flag_default() { var expected = new[] { Sigo.Create(3) }; SigoAssert.Equal(expected, Gen("{ }")); }
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 }); }
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()); } }
public void Object_flag_() { var expected = new[] { Sigo.Create(0), Sigo.Create(3), Sigo.Create(7) }; SigoAssert.Equal(expected, Gen("{037}")); }
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}")); }
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}")); }
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}")); }
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)); }
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("{?}")); }
public void UniqueTest() { SigoAssert.Equal(Leafs(2, 0), SigoSchema.Parse(src).Generate(GenerateOptions.Unique)); }
public void UniqueSortedTest() { SigoAssert.Equal(Leafs(0, 2), SigoSchema.Parse(src).Generate(GenerateOptions.UniqueSorted)); }
public void List_() { var expected = Leafs(false, true, 123, "abc"); SigoAssert.Equal(expected, Gen(" false | true | 123 | 'abc' ")); }
public void Statements_separator(string a) { SigoAssert.Equal(Leafs(1), Gen(a)); }
public void Var_set_return_empty() { SigoAssert.Equal(Leafs(), Gen("money='USD'|'VND'")); }
public void Var_get_() { Gen("money='USD'|'VND'"); SigoAssert.Equal(Leafs("bitcoin", "USD", "VND"), Gen("'bitcoin' | money")); }