public void Can_Set_Static_Properties() { var actualdate1 = DateTime.Today; var actualtime1 = new TimeSpan(0, 10, 8, 49); var expectdate1 = new DateTime(2012, 10, 29); var expecttime1 = new TimeSpan(0, 3, 15, 45); var actualdate2 = DateTime.Today.AddDays(1); var actualtime2 = new TimeSpan(0, 10, 33, 59); var expectdate2 = new DateTime(2012, 10, 30); var expecttime2 = new TimeSpan(0, 4, 16, 55); // Set nested class props. var nestedInstance = new KlassNested1(); nestedInstance.SetProps(23.45, "*****@*****.**", false, actualdate2, actualtime2); // Set clas props. Klass2.SetClassProps(12.34, "fluentscript", true, actualdate1, actualtime1, nestedInstance); var testcases = new List <Tuple <string, Type, object, string> >() { TestCase("result", typeof(string), "abcd", "Klass2.KPropString = 'abcd'; var result = Klass2.KPropString ; "), TestCase("result", typeof(bool), false, "Klass2.KPropBool = false; var result = Klass2.KPropBool ; "), TestCase("result", typeof(DateTime), expectdate1, "Klass2.KPropDate = new Date(2012, 10, 29); var result = Klass2.KPropDate ; "), TestCase("result", typeof(TimeSpan), expecttime1, "Klass2.KPropTime = new Time(0, 3, 15, 45); var result = Klass2.KPropTime ; "), TestCase("result", typeof(string), "nes1", "Klass2.KPropObject.KPropString = 'nes1'; var result = Klass2.KPropObject.KPropString ;"), TestCase("result", typeof(bool), true, "Klass2.KPropObject.KPropBool = true; var result = Klass2.KPropObject.KPropBool ;"), TestCase("result", typeof(DateTime), expectdate2, "Klass2.KPropObject.KPropDate = new Date(2012, 10, 30); var result = Klass2.KPropObject.KPropDate ;"), TestCase("result", typeof(TimeSpan), expecttime2, "Klass2.KPropObject.KPropTime = new Time(4, 16, 55); var result = Klass2.KPropObject.KPropTime ;"), }; Parse(testcases, true, (i) => i.Context.Types.Register(typeof(Klass2), null)); }
public void Can_Get_Static_Properties() { var actualdate1 = DateTime.Today.AddDays(1); var expectdate1 = DateTime.Today.AddDays(1); var actualtime1 = new TimeSpan(0, 10, 8, 49); var expecttime1 = new TimeSpan(0, 10, 8, 49); var actualdate2 = DateTime.Today.AddDays(2); var expectdate2 = DateTime.Today.AddDays(2); var actualtime2 = new TimeSpan(0, 10, 33, 59); var expecttime2 = new TimeSpan(0, 10, 33, 59); // Set nested class props. var nestedInstance = new KlassNested1(); nestedInstance.SetProps(23.45, "*****@*****.**", false, actualdate2, actualtime2); // Set clas props. Klass2.SetClassProps(12.34, "fluentscript", true, actualdate1, actualtime1, nestedInstance); var testcases = new List <Tuple <string, Type, object, string> >() { TestCase("result", typeof(double), 12.34, "var result = Klass2.KPropNumber"), TestCase("result", typeof(string), "fluentscript", "var result = Klass2.KPropString"), TestCase("result", typeof(bool), true, "var result = Klass2.KPropBool"), TestCase("result", typeof(DateTime), expectdate1, "var result = Klass2.KPropDate"), TestCase("result", typeof(TimeSpan), expecttime1, "var result = Klass2.KPropTime"), TestCase("result", typeof(double), 23.45, "var result = Klass2.KPropObject.KPropNumber"), TestCase("result", typeof(string), "*****@*****.**", "var result = Klass2.KPropObject.KPropString"), TestCase("result", typeof(bool), false, "var result = Klass2.KPropObject.KPropBool"), TestCase("result", typeof(DateTime), expectdate2, "var result = Klass2.KPropObject.KPropDate"), TestCase("result", typeof(TimeSpan), expecttime2, "var result = Klass2.KPropObject.KPropTime"), }; Parse(testcases, true, (i) => i.Context.Types.Register(typeof(Klass2), null)); }