public void MI_344_Invalid_DateParsing_Upmonitor()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse(" 27.08.2014, 10:40 Источник: http://www.regnum.ru/news/1840829.html");

            Assert.AreEqual(new DateTime(2014, 8, 27, 10, 40, 0), date);
        }
        public void MI_344_Invalid_DateParsing_PravdaUrfo()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("10.09.2014-19:23");

            Assert.AreEqual(new DateTime(2014, 9, 10, 19, 23, 0), date);
        }
        public void MI_353_Invalid_DateParsing_JustMedia_NoYear()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("17 сентября в 22:01");

            Assert.AreEqual(new DateTime(DateTime.Today.Year, 9, 17, 22, 01, 0), date);
        }
        public void MI_395_Invalid_DateParsing_Veved2()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("10:22 | 8.09.2014");

            Assert.AreEqual(new DateTime(2014, 9, 8, 10, 22, 0), date);
        }
        public void MI_344_Invalid_DateParsing_Veved()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("17:40 | 21.08.2014");

            Assert.AreEqual(new DateTime(2014, 8, 21, 17, 40, 0), date);
        }
        public void MI_344_Invalid_DateParsing_MStrok()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("27 Авг 2014 11:32 Экономисты предупреждают, что сильнее всего санкции ударят по простым гражданам");

            Assert.AreEqual(new DateTime(2014, 8, 27, 11, 32, 0), date);
        }
        public void MI_395_Invalid_DateParsing_DoubledE1()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("08 Сентябрь 2014, 18:56 - 07.09.2014 - 26.11.2013 - 01.11.2013");

            Assert.AreEqual(new DateTime(2014, 9, 8, 18, 56, 0), date);
        }
        public void MI_364_Invalid_DateParsing_Echo()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("14:42, 05 сентября 2014, 36 просмотров");

            Assert.AreEqual(new DateTime(2014, 9, 5, 14, 42, 0), date);
        }
        public void ZU_261_UralPolit_GMT()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("Sat, 13 Sep 2014 09:33:35 GMT");

            Assert.AreEqual(new DateTime(2014, 9, 13, 15, 33, 35), date);
        }
        public void ZU_261_Nakanune_MSK()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("14.09.2014 11:01 Мск (13:01 Екб) политика | Челябинская область | Уральский ФО");

            Assert.AreEqual(new DateTime(2014, 9, 14, 13, 01, 0), date);
        }
        public void MI_353_Invalid_DateParsing_JustMedia()
        {
            var parser    = new WebDateTimeParser();
            var date      = WebDateTimeParser.Parse("Вчера в 22:01");
            var yesterday = DateTime.Today.AddDays(-1);

            Assert.AreEqual(new DateTime(yesterday.Year, yesterday.Month, yesterday.Day, 22, 01, 0), date);
        }
        public void MI_395_Invalid_Date_WithToday()
        {
            var parser = new WebDateTimeParser();
            var date   = WebDateTimeParser.Parse("Сегодня в 18:30");
            var today  = DateTime.Today;

            Assert.AreEqual(new DateTime(today.Year, today.Month, today.Day, 18, 30, 0), date);
        }
        public void MI_481_Mk_Date()
        {
            var date  = WebDateTimeParser.Parse("Два дня назад в 18:37");
            var day2b = DateTime.Today.AddDays(-2);

            Assert.AreEqual(new DateTime(day2b.Year, day2b.Month, day2b.Day, 18, 37, 0), date);

            date = WebDateTimeParser.Parse("Три дня назад в 18:37");
            var day3b = DateTime.Today.AddDays(-3);

            Assert.AreEqual(new DateTime(day3b.Year, day3b.Month, day3b.Day, 18, 37, 0), date);
        }
            public void IscorrectPArsingNDaysAgo(string str, int o)
            {
                var n = new DateTime(DateTime.Today.Year, 1, o + 1, 0, 0, 0);
                var p = WebDateTimeParser.Parse(str, baseDate: n);

                Assert.AreEqual(DateTime.Today.Year, p.Year);
                Assert.AreEqual(1, p.Month);
                Assert.AreEqual(1, p.Day);
                Assert.AreEqual(0, p.Hour);
                Assert.AreEqual(0, p.Minute);
                Assert.AreEqual(0, p.Second);
            }
        public void ExplicitTimeZoneSupport(int timeZone)
        {
            var src         = "23.12.2014 23:25";
            var tres        = WebDateTimeParser.Parse(src, timeZone: timeZone);
            var lres        = TypeConverter.ToDate(src);
            var currentZone = (DateTime.Today - DateTime.Today.ToUniversalTime()).TotalHours;
            var diff        = timeZone - currentZone;

            Console.WriteLine(lres);
            Console.WriteLine(tres);
            Assert.AreEqual(diff, (tres - lres).TotalHours);
        }
        public void CanParse(string input, int y, int m, int d, int h, int min, int s, char dd, char td, string cult, bool dyn = false, bool istoday = false)
        {
            var parsed = WebDateTimeParser.Parse(input);

            if (dyn)
            {
                var f = istoday ? DateTime.Now : DateTime.Now.AddDays(-1);
                Assert.AreEqual(f.Year, parsed.Year);
                Assert.AreEqual(f.Month, parsed.Month);
                Assert.AreEqual(f.Day, parsed.Day);
            }
            else
            {
                Assert.AreEqual(y == -1 ? DateTime.Now.Year : y, parsed.Year);
                Assert.AreEqual(m, parsed.Month);
                Assert.AreEqual(d, parsed.Day);
            }

            Assert.AreEqual(h, parsed.Hour);
            Assert.AreEqual(min, parsed.Minute);
            Assert.AreEqual(s, parsed.Second);
        }
        public void MI_344_Invalid_DateParsing()
        {
            var date = WebDateTimeParser.Parse("Автор: Роман Слюнов, 2014-06-18 01:28:01");

            Assert.AreEqual(new DateTime(2014, 6, 18, 1, 28, 0), date);
        }