Ejemplo n.º 1
0
 public void ParseUndefined_NullableDateTimeWithFormat_Parsed()
 {
     Assert.AreEqual((DateTime?)new DateTime(2014, 03, 15),
                     StringToSpecifiedObjectParser.ParseUndefined("15.03.2014", typeof(DateTime?), "dd.MM.yyyy"));
 }
Ejemplo n.º 2
0
 public void ParseUndefined_DateTimeBadValue_ExceptionThrown()
 {
     Assert.Throws <ModelBindingException>(() => StringToSpecifiedObjectParser.ParseUndefined("test", typeof(DateTime)));
 }
Ejemplo n.º 3
0
 public void ParseUndefined_NullableDateTime_Parsed()
 {
     Assert.AreEqual((DateTime?)new DateTime(2014, 03, 15),
                     StringToSpecifiedObjectParser.ParseUndefined("2014-03-15T00:00:00.0000000", typeof(DateTime?)));
 }
Ejemplo n.º 4
0
 public void ParseUndefined_NullableBoolOnValue_Parsed()
 {
     Assert.AreEqual((bool?)true, StringToSpecifiedObjectParser.ParseUndefined("on", typeof(bool?)));
 }
Ejemplo n.º 5
0
 public void ParseUndefined_DateTimeWithFormatNull_DefaulDateTime()
 {
     Assert.AreEqual(default(DateTime), StringToSpecifiedObjectParser.ParseUndefined(null, typeof(DateTime), "dd.MM.yyyy"));
 }
Ejemplo n.º 6
0
 public void ParseUndefined_NullableDateTimeWithFormatBadValue_ExceptionThrown()
 {
     Assert.Throws <ModelBindingException>(() => StringToSpecifiedObjectParser.ParseUndefined("test", typeof(DateTime?), "dd.MM.yyyy"));
 }
Ejemplo n.º 7
0
 public void ParseUndefined_UndefinedType_ExceptionThrown()
 {
     Assert.Throws <ModelBindingException>(() => StringToSpecifiedObjectParser.ParseUndefined("test", typeof(Array)));
 }
Ejemplo n.º 8
0
 public void ParseUndefined_LongNull_DefaulLong()
 {
     Assert.AreEqual(default(long), StringToSpecifiedObjectParser.ParseUndefined(null, typeof(long)));
 }
Ejemplo n.º 9
0
 public void ParseUndefined_NullableLong_Parsed()
 {
     Assert.AreEqual((long?)15, StringToSpecifiedObjectParser.ParseUndefined("15", typeof(long?)));
 }
Ejemplo n.º 10
0
 public void ParseUndefined_NullableDecimal_Parsed()
 {
     Assert.AreEqual((decimal?)15, StringToSpecifiedObjectParser.ParseUndefined("15", typeof(decimal?)));
 }
Ejemplo n.º 11
0
 public void ParseUndefined_NullableDecimalNull_Null()
 {
     Assert.IsNull(StringToSpecifiedObjectParser.ParseUndefined(null, typeof(decimal?)));
 }
Ejemplo n.º 12
0
 public void ParseUndefined_DecimalNull_DefaulDecimal()
 {
     Assert.AreEqual(default(decimal), StringToSpecifiedObjectParser.ParseUndefined(null, typeof(decimal)));
 }
Ejemplo n.º 13
0
 public void ParseUndefined_IntNull_DefaulInt()
 {
     Assert.AreEqual(default(int), StringToSpecifiedObjectParser.ParseUndefined(null, typeof(int)));
 }
Ejemplo n.º 14
0
 public void ParseUndefined_Int_Parsed()
 {
     Assert.AreEqual(15, StringToSpecifiedObjectParser.ParseUndefined("15", typeof(int)));
 }
Ejemplo n.º 15
0
 public void ParseUndefined_NullableDateTimeNull_DefaulDateTime()
 {
     Assert.IsNull(StringToSpecifiedObjectParser.ParseUndefined(null, typeof(DateTime?)));
 }
Ejemplo n.º 16
0
 public void ParseUndefined_NullableLongNull_Null()
 {
     Assert.IsNull(StringToSpecifiedObjectParser.ParseUndefined(null, typeof(long?)));
 }
Ejemplo n.º 17
0
 public void ParseUndefined_NullableDateTimeWithFormatNull_DefaulDateTime()
 {
     Assert.IsNull(StringToSpecifiedObjectParser.ParseUndefined(null, typeof(DateTime?), "dd.MM.yyyy"));
 }
Ejemplo n.º 18
0
 public void ParseUndefined_NullableLongBadValue_ExceptionThrown()
 {
     Assert.Throws <ModelBindingException>(() => StringToSpecifiedObjectParser.ParseUndefined("test", typeof(long?)));
 }
Ejemplo n.º 19
0
 public void ParseUndefined_Enum_Parsed()
 {
     Assert.AreEqual(TestEnum.Value1, StringToSpecifiedObjectParser.ParseUndefined("1", typeof(TestEnum)));
 }
Ejemplo n.º 20
0
 public void ParseUndefined_DateTimeNull_DefaulDateTime()
 {
     Assert.AreEqual(default(DateTime), StringToSpecifiedObjectParser.ParseUndefined(null, typeof(DateTime)));
 }
Ejemplo n.º 21
0
 public void ParseUndefined_String_Parsed()
 {
     Assert.AreEqual("test", StringToSpecifiedObjectParser.ParseUndefined("test", typeof(string)));
 }
Ejemplo n.º 22
0
 public void ParseUndefined_Bool_Parsed()
 {
     Assert.AreEqual(true, StringToSpecifiedObjectParser.ParseUndefined("true", typeof(bool)));
 }