예제 #1
0
        public void GetElapsedTime(int day, int elapsedTime, bool isAfterCurrent)
        {
            Mock <IDatos>   idatos          = new Mock <IDatos>();
            DateTimeService dateTimeService = new DateTimeService();

            idatos.Setup(m => m.Date).Returns(new DateTime(2020, 1, day));
            dateTimeService.CurrentDateTime = () => new DateTime(2020, 1, 20);
            var result = dateTimeService.GetElapsedTime(idatos.Object, isAfterCurrent);


            TimeSpan timeSpan = new TimeSpan(elapsedTime, 0, 0, 0);

            Assert.AreEqual(timeSpan, result);
        }