public async void StudentId_Create_Valid_Reference() { Mock <ILessonXStudentRepository> lessonXStudentRepository = new Mock <ILessonXStudentRepository>(); lessonXStudentRepository.Setup(x => x.GetStudent(It.IsAny <int>())).Returns(Task.FromResult <Student>(new Student())); var validator = new ApiLessonXStudentRequestModelValidator(lessonXStudentRepository.Object); await validator.ValidateCreateAsync(new ApiLessonXStudentRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.StudentId, 1); }
public async void LessonId_Update_Valid_Reference() { Mock <ILessonXStudentRepository> lessonXStudentRepository = new Mock <ILessonXStudentRepository>(); lessonXStudentRepository.Setup(x => x.GetLesson(It.IsAny <int>())).Returns(Task.FromResult <Lesson>(new Lesson())); var validator = new ApiLessonXStudentRequestModelValidator(lessonXStudentRepository.Object); await validator.ValidateUpdateAsync(default(int), new ApiLessonXStudentRequestModel()); validator.ShouldNotHaveValidationErrorFor(x => x.LessonId, 1); }