示例#1
0
        public static IEnumerable <object[]> ContainsCases()
        {
            var fixture = new ScenarioFixture();
            var period  = fixture.Create <Period>();

            var daysInMonth = CultureInfo.InvariantCulture.Calendar.GetDaysInMonth(period.Year, period.Month);

            foreach (var day in Enumerable.Range(1, daysInMonth))
            {
                yield return(new object[]
                             { period, new DateTimeOffset(new DateTime(period.Year, period.Month, day), TimeSpan.Zero), true });
            }

            yield return(new object[] {
                period,
                new DateTimeOffset(new DateTime(period.Year, period.Month, daysInMonth).AddDays(1), TimeSpan.Zero),
                false
            });

            yield return(new object[]
                         { period, new DateTimeOffset(new DateTime(period.Year, period.Month, 1).AddDays(-1), TimeSpan.Zero), false });

            yield return(new object[]
                         { period, new DateTimeOffset(new DateTime(period.Year, period.Month, 1), TimeSpan.FromHours(-1)), false });
        }
        public static IEnumerable <object[]> InvalidPrefixCases()
        {
            var fixture = new ScenarioFixture();

            yield return(new object[] { " ", fixture.Create <int>() });

            yield return(new object[] { string.Empty, fixture.Create <int>() });

            yield return(new object[] { " a", fixture.Create <int>() });

            yield return(new object[] { "a ", fixture.Create <int>() });

            yield return(new object[] { "a	", fixture.Create <int>() });

            yield return(new object[]
                         { new string('a', GeneralLedgerEntryNumber.MaxPrefixLength + 1), fixture.Create <int>() });
        }
示例#3
0
        public static IEnumerable <object[]> ContainsCases()
        {
            var fixture = new ScenarioFixture();
            var date    = fixture.Create <LocalDate>().ToYearMonth().OnDayOfMonth(1);

            var period = AccountingPeriod.Open(date);

            var daysInMonth = CalendarSystem.Iso.GetDaysInMonth(date.Year, date.Month);

            for (var day = 0; day < daysInMonth; day++)
            {
                yield return(new object[] { period, date.PlusDays(day), true });
            }

            yield return(new object[] { period, date.PlusDays(daysInMonth), false });

            yield return(new object[] { period, date.PlusDays(-1), false });
        }