コード例 #1
0
 public void AddPositiveYearsWithMonthTest()
 {
     try
     {
         var fd      = new FuzzyDate(2019, 6);
         var newDate = fd.AddYears(10);
         Assert.AreEqual(2029, newDate.Year);
         Assert.AreEqual(6, newDate.Month);
         Assert.IsFalse(newDate.Day.HasValue);
     }
     catch (Exception ex)
     {
         Assert.Fail($"Expect no exception, but got {ex.Message}");
     }
 }
コード例 #2
0
 public void AddToNullTest()
 {
     try
     {
         var fd      = new FuzzyDate();
         var newDate = fd.AddYears(10);
         Assert.IsFalse(newDate.Year.HasValue);
         Assert.IsFalse(newDate.Month.HasValue);
         Assert.IsFalse(newDate.Day.HasValue);
     }
     catch (Exception ex)
     {
         Assert.Fail($"Expect no exception, but got {ex.Message}");
     }
 }
コード例 #3
0
 public void AddZeroYearsTest()
 {
     try
     {
         var fd      = new FuzzyDate(2019);
         var newDate = fd.AddYears(0);
         Assert.AreEqual(2019, newDate.Year);
         Assert.IsFalse(newDate.Month.HasValue);
         Assert.IsFalse(newDate.Day.HasValue);
     }
     catch (Exception ex)
     {
         Assert.Fail($"Expect no exception, but got {ex.Message}");
     }
 }