Example #1
0
        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="));
        }
Example #2
0
        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"));
        }
Example #3
0
        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"));
        }
Example #4
0
        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));
            }
        }
Example #5
0
 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));
     }
 }
Example #6
0
 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="));
 }
Example #7
0
 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"));
 }
Example #8
0
 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"));
 }