Ejemplo n.º 1
0
        public void CountTimeUnits_ReturnsZero_IfTheSameDateIsGiven()
        {
            //Arrange
            MonthsProcessor processor    = new MonthsProcessor();
            DateTime        baseDate     = new DateTime(2017, 5, 4, 0, 0, 0);
            DateTime        comparedDate = new DateTime(2017, 5, 4, 0, 0, 0);

            //Act
            int unitsBetween = processor.CountTimeUnits(baseDate, comparedDate, 1);

            //Assert
            int expected = 0;

            Assert.AreEqual(expected, unitsBetween);
        }
Ejemplo n.º 2
0
        public void CountTimeUnits_ReturnsProperValue_IfComparedDateIsFromPreviousYear()
        {
            //Arrange
            MonthsProcessor processor    = new MonthsProcessor();
            DateTime        baseDate     = new DateTime(2016, 4, 20);
            DateTime        comparedDate = new DateTime(2012, 6, 21);

            //Act
            int unitsBetween = processor.CountTimeUnits(baseDate, comparedDate, 1);

            //Assert
            int expected = -46;

            Assert.AreEqual(expected, unitsBetween);
        }
Ejemplo n.º 3
0
        public void CountTimeUnits_ReturnsZero_IfBothDatesInTheSameWeekButBaseDateIsLater()
        {
            //Arrange
            MonthsProcessor processor    = new MonthsProcessor();
            DateTime        baseDate     = new DateTime(2016, 4, 15);
            DateTime        comparedDate = new DateTime(2016, 4, 2);

            //Act
            int unitsBetween = processor.CountTimeUnits(baseDate, comparedDate, 1);

            //Assert
            int expected = 0;

            Assert.AreEqual(expected, unitsBetween);
        }
Ejemplo n.º 4
0
        public void CountTimeUnits_ReturnsProperValue_IfBaseDateIsEarlier()
        {
            //Arrange
            MonthsProcessor processor    = new MonthsProcessor();
            DateTime        baseDate     = new DateTime(2016, 4, 1);
            DateTime        comparedDate = new DateTime(2016, 4, 21);

            //Act
            int unitsBetween = processor.CountTimeUnits(baseDate, comparedDate, 1);

            //Assert
            int expected = 0;

            Assert.AreEqual(expected, unitsBetween);
        }
Ejemplo n.º 5
0
        public void CountTimeUnits_ReturnsProperValue_IfComparedDateIsNotFirstDayOfMonth()
        {
            //Arrange
            MonthsProcessor processor    = new MonthsProcessor();
            DateTime        baseDate     = new DateTime(2016, 4, 1);
            DateTime        comparedDate = new DateTime(2016, 11, 16);

            //Act
            int unitsBetween = processor.CountTimeUnits(baseDate, comparedDate, 1);

            //Assert
            int expected = 7;

            Assert.AreEqual(expected, unitsBetween);
        }