Ejemplo n.º 1
0
        static bool TestDateParserError(string failString)
        {
            DateTime dtParsed;

            if (ExifTool.TryParseDate(failString, DateTimeKind.Unspecified, out dtParsed))
            {
                Console.WriteLine("Date parse should have failed: {0}", failString);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        static bool TestDateParser(int year, int month, int day, int hour, int minute, int second)
        {
            string   dtFormatted = string.Format("{0:D4}:{1:D2}:{2:D2} {3:D2}:{4:D2}:{5:D2}", year, month, day, hour, minute, second);
            DateTime dtParsed;

            if (!ExifTool.TryParseDate(dtFormatted, DateTimeKind.Unspecified, out dtParsed))
            {
                Console.WriteLine("Date Parse failed to parse: {0}", dtFormatted);
                return(false);
            }

            DateTime dtComposed = new DateTime(year, month, day, hour, minute, second, DateTimeKind.Unspecified);

            if (!dtParsed.Equals(dtComposed))
            {
                Console.WriteLine("Date Parse doesn't match: {0}", dtFormatted);
                return(false);
            }
            return(true);
        }