Exemplo n.º 1
0
        public void _03_Creer_une_classe_MockClockService_pour_controller_le_temps()
        {
            var dateTimeToReturn = DateTime.Now;

            MockClockService mockClockService = new MockClockService(dateTimeToReturn);

            Assert.NotNull(mockClockService);

            DateTime now = mockClockService.Now();

            Assert.Equal(dateTimeToReturn, now);
        }
Exemplo n.º 2
0
        public void _04_Creer_une_interface_IClockService_pour_unifier_MockClockService_et_ClockService()
        {
            IClockService clockService;
            DateTime?     now;

            clockService = new ClockService();

            Assert.NotNull(clockService);

            now = clockService.Now();

            Assert.NotNull(now);

            clockService = new MockClockService(DateTime.Now);

            Assert.NotNull(clockService);

            now = clockService.Now();

            Assert.NotNull(now);
        }