Esempio n. 1
0
        public void Parse_EqualsExpectedResult(MonthTestItem <string> monthTestItem)
        {
            var monthFromText = Month.Parse(monthTestItem.ExpectedResult); // TODO bad use of Expected result?
            var expectedMonth = monthTestItem.Create();

            Assert.AreEqual(expectedMonth, monthFromText);
        }
Esempio n. 2
0
        public void MinusOperatorIntParameter_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem)
        {
            var month = monthTestItem.Create();
            var monthAfterSubtraction = month - monthTestItem.ParameterValue;

            Assert.AreEqual(monthTestItem.ExpectedResult, monthAfterSubtraction);
        }
Esempio n. 3
0
        public void AdditionOperator_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem)
        {
            var month = monthTestItem.Create();
            var monthAfterAddition = month + monthTestItem.ParameterValue;

            Assert.AreEqual(monthTestItem.ExpectedResult, monthAfterAddition);
        }
Esempio n. 4
0
        public void MinusOperatorMonthParameter_ReturnsExpectedResult(MonthTestItem <Month, int> monthTestItem)
        {
            var month1 = monthTestItem.Create();
            var diff   = month1 - monthTestItem.ParameterValue;

            Assert.AreEqual(monthTestItem.ExpectedResult, diff);
        }
Esempio n. 5
0
        public void Offset_ReturnsExpectedResult(MonthTestItem <int, Month> monthTestItem)
        {
            var startMonth  = monthTestItem.Create();
            var offsetMonth = startMonth.Offset(monthTestItem.ParameterValue);

            Assert.AreEqual(monthTestItem.ExpectedResult, offsetMonth);
        }
Esempio n. 6
0
        public void End_ShouldEqualDateTimeForStartOfNextMonth(MonthTestItem monthTestItem)
        {
            var month       = monthTestItem.Create();
            var expectedEnd = new DateTime(monthTestItem.YearNum, monthTestItem.MonthOfYear, 1).AddMonths(1);

            Assert.AreEqual(expectedEnd, month.End);
        }
Esempio n. 7
0
        public void Start_ShouldEqualDateTimeForStartOfMonth(MonthTestItem monthTestItem)
        {
            var month         = monthTestItem.Create();
            var expectedStart = new DateTime(monthTestItem.YearNum, monthTestItem.MonthOfYear, 1);

            Assert.AreEqual(expectedStart, month.Start);
        }
Esempio n. 8
0
        public void ToString_EqualsExpectedResult(
            MonthTestItem <string> monthTestItem)
        {
            var month     = monthTestItem.Create();
            var formatted = month.ToString();

            Assert.AreEqual(monthTestItem.ExpectedResult, formatted);
        }
Esempio n. 9
0
        public void OffsetFrom_ReturnsExpectedResult(MonthTestItem <Month, int> monthTestItem)
        {
            var month1     = monthTestItem.Create();
            var month2     = monthTestItem.ParameterValue;
            var offsetFrom = month1.OffsetFrom(month2);

            Assert.AreEqual(monthTestItem.ExpectedResult, offsetFrom);
        }
Esempio n. 10
0
        public void Deconstruct_ReturnsComponentsUsedToConstruct(MonthTestItem testItem)
        {
            var month = testItem.Create();

            (int year, int monthOfYear) = month;
            Assert.AreEqual(testItem.YearNum, year);
            Assert.AreEqual(testItem.MonthOfYear, monthOfYear);
        }
Esempio n. 11
0
 public void Constructor_WithMonthParameterOutOfRange_ThrowsArgumentOutOfRangeException(MonthTestItem month)
 {
     // ReSharper disable once ObjectCreationAsStatement
     Assert.Throws <ArgumentOutOfRangeException>(() => month.Create());
 }
Esempio n. 12
0
        public void MonthOfYearProperty_EqualsMonthUsedToConstruct(MonthTestItem monthTestItem)
        {
            var month = monthTestItem.Create();

            Assert.AreEqual(monthTestItem.MonthOfYear, month.MonthOfYear);
        }
Esempio n. 13
0
        public void YearProperty_EqualsYearUsedToConstruct(MonthTestItem monthTestItem)
        {
            var month = monthTestItem.Create();

            Assert.AreEqual(monthTestItem.YearNum, month.Year);
        }