public async void Name_Update_length() { Mock <IShiftRepository> shiftRepository = new Mock <IShiftRepository>(); shiftRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Shift())); var validator = new ApiShiftRequestModelValidator(shiftRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiShiftRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Name, new string('A', 51)); }
private async void BeUniqueByStartTimeEndTime_Update_Not_Exists() { Mock <IShiftRepository> shiftRepository = new Mock <IShiftRepository>(); shiftRepository.Setup(x => x.ByStartTimeEndTime(It.IsAny <TimeSpan>(), It.IsAny <TimeSpan>())).Returns(Task.FromResult <Shift>(null)); var validator = new ApiShiftRequestModelValidator(shiftRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiShiftRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.EndTime, TimeSpan.Parse("0")); }