public void Constructor_ShouldCreateCorrectInstanceWhenAllParametersAreValid() { var mapperStub = new Mock <IMapper>(); var weekScheduleServiceStub = new Mock <IWeekScheduleService>(); var sut = new PublicScheduleController(mapperStub.Object, weekScheduleServiceStub.Object); Assert.IsInstanceOf <PublicScheduleController>(sut); }
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); }
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); }