コード例 #1
0
        public void AsDateTimeNegativeTest()
        {
            string   value        = "02/79/11";
            DateTime defaultValue = new DateTime();
            DateTime actual       = StringExtensions.AsDateTime(value, defaultValue);

            Assert.IsTrue(actual.Equals(defaultValue));
        }
コード例 #2
0
        public void AsDateTimeTest()
        {
            string   value        = Convert.ToString(DateTime.Now, CultureInfo.InvariantCulture);
            DateTime expected     = DateTime.Parse(value, CultureInfo.InvariantCulture);
            DateTime defaultValue = new DateTime();
            DateTime actual       = StringExtensions.AsDateTime(value, defaultValue);

            Assert.IsTrue(actual.Equals(expected));
        }