Exemplo n.º 1
0
        public void TranslateFormatFromDotNetWhereFormatForEraExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "g, gg";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "g', 'gg");
        }
Exemplo n.º 2
0
        public void TranslateFormatFromDotNetWhereFormatForFullLongTimeExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "dddd', 'dd MMMM yyyy HH:mm:ss";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "DW', 'dd' 'MM' 'yyyy' '24h':'min':'ss");
        }
Exemplo n.º 3
0
        public void TranslateFormatFromDotNetWhereFormatForTimeZonesExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "'Hours offset from UTC: 'z', Hours offset from UTC, with a leading zero: 'zz', Offset with minutes: 'zzz";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "'Hours offset from UTC: 'z', Hours offset from UTC, with a leading zero: 'zz', Offset with minutes: 'zzz");
        }
Exemplo n.º 4
0
        public void TranslateFormatFromDotNetWhereFormatForRoundTripExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "yyyy'-'mm'-'dd'T'24h':'min':'ss'.'fffffffK");
        }
Exemplo n.º 5
0
        public void TranslateFormatFromDotNetWhereFormatForLongTimeExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "HH:mm:ss.fffffff";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "24h':'min':'ss'.'fffffff");
        }
Exemplo n.º 6
0
        public void TranslateFormatFromDotNetWhereFormatForNonZeroSplitSecondsExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "F- FF- FFF- FFFF- FFFFFF- FFFFFFF-";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "F'- 'FF'- 'FFF'- 'FFFF'- 'FFFFFF'- 'FFFFFFF'-'");
        }
Exemplo n.º 7
0
        public void TranslateFormatFromDotNetWhereFormatForShortDateExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "MM/dd/yyyy";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "mm'/'dd'/'yyyy");
        }
Exemplo n.º 8
0
        public void TranslateFormatFromDotNetWhereFormatOfDayoftheMonthExpectedInDev2Format()
        {
            //initialize
            IDateTimeParser translatingParser = new DateTimeParser();
            string inputFormat = "d, dd, ddd, dddd";
            string error;

            //execute
            inputFormat = translatingParser.TranslateDotNetToDev2Format(inputFormat, out error);
            Assert.IsTrue(string.IsNullOrEmpty(error));
            Assert.AreEqual(inputFormat, "d', 'dd', 'dW', 'DW");
        }
Exemplo n.º 9
0
 public string GetDateTimeFormatInformation()
 {
     var dateTimeParser = new DateTimeParser();
     string error;
     var translatedDateTimeFormat = dateTimeParser.TranslateDotNetToDev2Format(CultureInfo.CurrentUICulture.DateTimeFormat.FullDateTimePattern, out error);
     return translatedDateTimeFormat;
 }