//[ExpectedException(typeof(Exception), // "You are not registered")] public void GetSheduleGroup_ShouldCallOnce() { //arrange sheduleRepository.Setup(x => x.FindById(It.IsAny <int>())).Returns(new Shedule { Auditorys_Number = It.IsAny <int>(), Day = It.IsAny <int>(), Pair = It.IsAny <int>(), UserId = It.IsAny <int>(), Group = It.IsAny <int>() }); //act //var ex = Assert.Catch<Exception>( // () => sheduleService.GetSheduleGroup(It.IsAny<int>())); try { sheduleService.GetSheduleGroup(It.IsAny <int>()); uow.Verify(x => x.Shedules, Times.AtLeast(1)); } catch (Exception ex) { Assert.That(ex.Message.Contains("You are not registered")); uow.Verify(x => x.Shedules, Times.Never); } //Assert.That(() => sheduleService.GetSheduleGroup(It.IsAny<int>()), Throws.Exception.Contains("You are not registered")); //Assert.IsTrue(ex.Message.Contains("You are not registered")); //assert // Assert.Throws<Exception>(delegate { sheduleService.GetSheduleGroup) }
public IEnumerable <SheduleModel> GetSheduleGroup(int group) { return(TeacherControllerMapper.Map <IEnumerable <SheduleDTO>, IEnumerable <SheduleModel> >(SheduleLogic.GetSheduleGroup(group))); }
public IEnumerable <SheduleModel> GetGroupShedule(int group) { return(ManagemantMap.Map <IEnumerable <SheduleDTO>, IEnumerable <SheduleModel> >(SheduleLogic.GetSheduleGroup(group))); }