public async void Action_Update_length() { Mock <IDeviceActionRepository> deviceActionRepository = new Mock <IDeviceActionRepository>(); deviceActionRepository.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new DeviceAction())); var validator = new ApiDeviceActionServerRequestModelValidator(deviceActionRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiDeviceActionServerRequestModel()); validator.ShouldHaveValidationErrorFor(x => x.Action, new string('A', 4001)); }
public async void DeviceId_Update_Valid_Reference() { Mock <IDeviceActionRepository> deviceActionRepository = new Mock <IDeviceActionRepository>(); deviceActionRepository.Setup(x => x.DeviceByDeviceId(It.IsAny <int>())).Returns(Task.FromResult <Device>(new Device())); var validator = new ApiDeviceActionServerRequestModelValidator(deviceActionRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiDeviceActionServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.DeviceId, 1); }