public async void UserName_Create_null() { Mock<IErrorLogRepository> errorLogRepository = new Mock<IErrorLogRepository>(); errorLogRepository.Setup(x => x.Get(It.IsAny<int>())).Returns(Task.FromResult(new ErrorLog())); var validator = new ApiErrorLogRequestModelValidator(errorLogRepository.Object); await validator.ValidateCreateAsync(new ApiErrorLogRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.UserName, null as string); }
public async void ErrorProcedure_Create_length() { Mock<IErrorLogRepository> errorLogRepository = new Mock<IErrorLogRepository>(); errorLogRepository.Setup(x => x.Get(It.IsAny<int>())).Returns(Task.FromResult(new ErrorLog())); var validator = new ApiErrorLogRequestModelValidator(errorLogRepository.Object); await validator.ValidateCreateAsync(new ApiErrorLogRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.ErrorProcedure, new string('A', 127)); }