Example #1
0
 public void Can_Be_Created_From_Integer_Year(
     int year)
 {
     TwoThousandsCommonEraYear
     .FromYearAsNumber(year)
     .Should()
     .NotBeNull();
 }
Example #2
0
 public void Throws_Exception_When_Trying_To_Create_From_Invalid_Integer_Year(
     int invalidYear)
 {
     Assert
     .That(
         () => TwoThousandsCommonEraYear.FromYearAsNumber(invalidYear),
         Throws
         .Exception
         .TypeOf <ArgumentException>());
 }
        public static Period FromInstantInPeriod(DateTime instantInPeriod)
        {
            var endYear =
                instantInPeriod.Month < 4
                    ? instantInPeriod.Year - 1
                    : instantInPeriod.Year;

            return(new Period(
                       startYear: TwoThousandsCommonEraYear.FromYearAsNumber(endYear - 1),
                       endYear: TwoThousandsCommonEraYear.FromYearAsNumber(endYear)));
        }