Beispiel #1
0
        public void Execute_TextToDateTimeWithCulture_Valid(string value, string format, string culture, DateTime expected)
        {
            var function = new TextToDateTime(new LiteralScalarResolver <string>(format), new LiteralScalarResolver <string>(culture));
            var result   = function.Evaluate(value);

            Assert.That(result, Is.EqualTo(expected));
        }
Beispiel #2
0
        public void Execute_TextToDateTime_Valid(string value, string format, DateTime expected)
        {
            var function = new TextToDateTime(new LiteralScalarResolver <string>(format));
            var result   = function.Evaluate(value);

            Assert.That(result, Is.EqualTo(expected));
            Assert.That(((DateTime)result).Kind, Is.EqualTo(DateTimeKind.Unspecified));
        }
Beispiel #3
0
        public void Execute_TextToDateTimeAndUtcToLocal_Valid(string value, string format, string timeZone, DateTime expected)
        {
            var textToDateTime = new TextToDateTime(new LiteralScalarResolver <string>(format));
            var utcToLocal     = new UtcToLocal(new LiteralScalarResolver <string>(timeZone));
            var result         = utcToLocal.Evaluate(textToDateTime.Evaluate(value));

            Assert.That(result, Is.EqualTo(expected));
            Assert.That(((DateTime)result).Kind, Is.EqualTo(DateTimeKind.Unspecified));
        }