public void DateTimeAutoValueTestTag_Should_Be_Null_Safe() { var _model = new TagModel(new Hashtable()); var tag = new DateTimeAutoValueTestTag(); Assert.That(tag.Evaluate(_model), Is.EqualTo("date=")); }
public void DateTimeAutoValueTestTag_Should_Pass_Date() { var _model = new TagModel(new Hashtable() { { "SomeDate", new DateTime(1979, 10, 2, 11, 55, 44) } }); var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); Assert.That(tag.Evaluate(_model), Is.EqualTo("date=02|10|1979|11|55|44")); }
public void DateTimeAutoValueTestTag_Should_Parse_Date() { var _model = new TagModel(new Hashtable() { { "SomeDate", "1979-10-02T11:55:44" } }); var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); Assert.That(tag.Evaluate(_model), Is.EqualTo("date=02|10|1979|11|55|44")); }
public void DateTimeAutoValueTestTag_Should_Include_Value_And_Pattern_Into_Exception() { var _model = new TagModel(new Hashtable() { { "SomeDate", "pindakaas" } }); try { var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); tag.Evaluate(_model); Assert.Fail("Exception expected"); } catch (FormatException Fe) { Console.WriteLine(Fe.Message); Assert.That(Fe.Message.Contains("pindakaas")); Assert.That(Fe.Message.Contains(PatternStrings.DATETIME_FORMAT)); } }
public void DateTimeAutoValueTestTag_Should_Include_Value_And_Pattern_Into_Exception() { var _model = new TagModel(new Hashtable() { { "SomeDate", "pindakaas"} }); try { var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); tag.Evaluate(_model); Assert.Fail("Exception expected"); } catch (FormatException Fe) { Console.WriteLine(Fe.Message); Assert.That(Fe.Message.Contains("pindakaas")); Assert.That(Fe.Message.Contains(PatternStrings.DATETIME_FORMAT)); } }
public void DateTimeAutoValueTestTag_Should_Pass_Date() { var _model = new TagModel(new Hashtable() { { "SomeDate", new DateTime(1979,10,2,11,55,44)} }); var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); Assert.That(tag.Evaluate(_model), Is.EqualTo("date=02|10|1979|11|55|44")); }
public void DateTimeAutoValueTestTag_Should_Parse_Date() { var _model = new TagModel(new Hashtable() { { "SomeDate", "1979-10-02T11:55:44"} }); var tag = new DateTimeAutoValueTestTag(); tag.SomeDateValue = new MockAttribute(new Property("SomeDate")); Assert.That(tag.Evaluate(_model), Is.EqualTo("date=02|10|1979|11|55|44")); }