Esempio n. 1
0
        public void ParseEasyDate_handlesISOFormatDate()
        {
            var jan21 = EasyDateParser.ParseEasyDate("2018-01-21");

            jan21.Day.Should().Be(21);
            jan21.Month.Should().Be(1);
            jan21.Year.Should().Be(2018);
        }
Esempio n. 2
0
        public void ParseEasyDate_handlesStringDec9_2018()
        {
            var jan21 = EasyDateParser.ParseEasyDate("December-9-2018");

            jan21.Day.Should().Be(9);
            jan21.Month.Should().Be(12);
            jan21.Year.Should().Be(2018);
        }
Esempio n. 3
0
        public void ParseEasyDate_handles_null()
        {
            var today      = EasyDateParser.GetUtcNow();
            var dateToTest = EasyDateParser.ParseEasyDate(null);

            dateToTest.Day.Should().Be(today.Day);
            dateToTest.Month.Should().Be(today.Month);
            dateToTest.Year.Should().Be(today.Year);
        }
Esempio n. 4
0
        public void ParseEasyDate_handles_yesterday_text()
        {
            var yesterday  = EasyDateParser.GetUtcNow().AddDays(-1);
            var dateToTest = EasyDateParser.ParseEasyDate("yesterday");

            dateToTest.Day.Should().Be(yesterday.Day);
            dateToTest.Month.Should().Be(yesterday.Month);
            dateToTest.Year.Should().Be(yesterday.Year);
        }
Esempio n. 5
0
        public void ParseEasyDate_handlesStringJan21()
        {
            var year = DateTime.UtcNow.Year;

            var jan21 = EasyDateParser.ParseEasyDate("jan-21");

            jan21.Day.Should().Be(21);
            jan21.Month.Should().Be(1);
            jan21.Year.Should().Be(year);
        }
Esempio n. 6
0
        public void InterpretHoursRecordMessage_canInterpretNonBillableWithVarietyText(string nonbillText, string description, double hours, string dateText)
        {
            var sut = new HoursInterpreter().InterpretMessage(ToPayload($"record {nonbillText} {hours:F1} {description} {dateText ?? ""}"));

            if (dateText != "some non bill reason")
            {
                sut.Date.Date.Should().Be(EasyDateParser.ParseEasyDate(dateText));
                sut.NonBillReason.Should().Be(description.Replace("\"", ""));
            }
            else
            {
                sut.Date.Date.Should().Be(EasyDateParser.ParseEasyDate(description));
                sut.NonBillReason.Should().Be(dateText.Replace("\"", ""));
            }

            sut.Hours.Should().Be(hours);
            sut.IsBillable.Should().BeFalse();
            sut.TimeEntryType.Should().Be(TimeEntryTypeEnum.NonBillable);
        }