Example #1
0
        public void Current_ShouldCAllMapperOnceWithCurrentSchedule()
        {
            var mapperStub = new Mock <IMapper>();
            var weekScheduleServiceStub = new Mock <IWeekScheduleService>();

            var sut = new PublicScheduleController(mapperStub.Object, weekScheduleServiceStub.Object);

            var currentSchedule = new WeekSchedule();
            var model           = new CurrentScheduleViewModel();

            weekScheduleServiceStub.Setup(x => x.GetCurrentSchedule()).Returns(currentSchedule);
            mapperStub.Setup(x => x.Map <CurrentScheduleViewModel>(It.IsAny <WeekSchedule>())).Returns(model);

            sut
            .WithCallTo(c => c.Current());

            mapperStub.Verify(x => x.Map <CurrentScheduleViewModel>(currentSchedule), Times.Once);
        }
Example #2
0
        public void Current_ShouldRenderDefaultViewWithCorrectModel()
        {
            var mapperStub = new Mock <IMapper>();
            var weekScheduleServiceStub = new Mock <IWeekScheduleService>();

            var sut = new PublicScheduleController(mapperStub.Object, weekScheduleServiceStub.Object);

            var currentSchedule = new WeekSchedule();
            var model           = new CurrentScheduleViewModel();

            weekScheduleServiceStub.Setup(x => x.GetCurrentSchedule()).Returns(currentSchedule);
            mapperStub.Setup(x => x.Map <CurrentScheduleViewModel>(It.IsAny <WeekSchedule>())).Returns(model);

            sut
            .WithCallTo(c => c.Current())
            .ShouldRenderDefaultView()
            .WithModel(model);
        }