public async void ToUserId_Create_Valid_Reference() { Mock <IMessengerRepository> messengerRepository = new Mock <IMessengerRepository>(); messengerRepository.Setup(x => x.UserByToUserId(It.IsAny <int>())).Returns(Task.FromResult <User>(new User())); var validator = new ApiMessengerServerRequestModelValidator(messengerRepository.Object); await validator.ValidateCreateAsync(new ApiMessengerServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.ToUserId, 1); }
public async void MessageId_Update_Valid_Reference() { Mock <IMessengerRepository> messengerRepository = new Mock <IMessengerRepository>(); messengerRepository.Setup(x => x.MessageByMessageId(It.IsAny <int>())).Returns(Task.FromResult <Message>(new Message())); var validator = new ApiMessengerServerRequestModelValidator(messengerRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiMessengerServerRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.MessageId, 1); }