Exemple #1
0
 public void Arrays()
 {
     Assert.AreEqual("System.String[]", Cd2Cd.GetTypeName(typeof(string[])));
 }
Exemple #2
0
 public void NestedGeneric1()
 {
     Assert.AreEqual("Tests.Name.MyTest3<System.String>.MyTest4<System.Int32>", Cd2Cd.GetTypeName(typeof(MyTest3 <string> .MyTest4 <int>)));
 }
Exemple #3
0
 public void Lists()
 {
     Assert.AreEqual("System.Collections.Generic.List<System.String>", Cd2Cd.GetTypeName(typeof(List <string>)));
 }
Exemple #4
0
 public void NestedClass()
 {
     Assert.AreEqual("Tests.Name.ClassNameTests.MyTest2", Cd2Cd.GetTypeName(typeof(MyTest2)));
 }
Exemple #5
0
 public void SimpleGeneric()
 {
     Assert.AreEqual("Tests.Name.MyTest3<System.String>", Cd2Cd.GetTypeName(typeof(MyTest3 <string>)));
 }
Exemple #6
0
 public void TestFromJsonWithEnumAsByte()
 {
     Assert.AreEqual("new Tests.New.GenericField<Tests.New.AnEnum>\n{\nValll = (Tests.New.AnEnum)1\n}", Cd2Cd.GenerateFromJson <GenericField <AnEnum> >("{\"Valll\":1}"));
 }
Exemple #7
0
 public void SmokeTest()
 {
     Assert.AreEqual("Tests.Name.MyTest1", Cd2Cd.GetTypeName(typeof(MyTest1)));
 }
Exemple #8
0
 public void TestFromJsonWithNull()
 {
     Assert.AreEqual("new Tests.New.GenericField<System.Nullable<System.Int32>>\n{\nValll = null\n}", Cd2Cd.GenerateFromJson <GenericField <int?> >("{\"Valll\":null}"));
 }
Exemple #9
0
 public void TestFromJsonWithIEnumerable()
 {
     Assert.AreEqual("new Tests.New.GenericField<System.Collections.Generic.IEnumerable<System.Int32>>\n{\nValll = new System.Collections.Generic.List<System.Int32>\n{\n5\n}\n}", Cd2Cd.GenerateFromJson <GenericField <IEnumerable <int> > >("{\"Valll\":[5]}"));
 }
Exemple #10
0
 public void TestGenericField2()
 {
     Assert.AreEqual("new Tests.New.GenericField<System.Nullable<System.Int32>>\n{\nValll = 5\n}", Cd2Cd.Generate(new GenericField <int?> {
         Valll = 5
     }));
 }
Exemple #11
0
 public void ClassEnumerablePropArray()
 {
     Assert.AreEqual("new Tests.New.ClassEnumerableProp1\n{\nVal = new System.String[]\n{\n\"aaa\"\n}\n}", Cd2Cd.Generate(new ClassEnumerableProp1 {
         Val = new string[] { "aaa" }
     }));
 }
Exemple #12
0
 public void ClassEnumerablePropList()
 {
     Assert.AreEqual("new Tests.New.ClassEnumerableProp1\n{\nVal = new System.Collections.Generic.List<System.String>\n{\n\"aaa\"\n}\n}", Cd2Cd.Generate(new ClassEnumerableProp1 {
         Val = new List <string> {
             "aaa"
         }
     }));
 }
Exemple #13
0
 public void Test2Props()
 {
     Assert.AreEqual("new Tests.New.Class2Props\n{\nStr = \"aaa\",\nInt = 5\n}", Cd2Cd.Generate(new Class2Props {
         Str = "aaa", Int = 5
     }));
 }
Exemple #14
0
 public void TestStringProp()
 {
     Assert.AreEqual("new Tests.New.ClassStringProp\n{\nStr = \"aaa\"\n}", Cd2Cd.Generate(new ClassStringProp {
         Str = "aaa"
     }));
 }