public async Task AddStudentAsync_WithValidationMessages_ReturnsValidationMessages() { var input = _fixture.Create <AddStudentRequest>(); var expectedValidationMessages = _fixture.CreateMany <ValidationMessage>(); _studentValidator .Setup(x => x.ValidateRules(input)) .Returns(expectedValidationMessages); AddStudentResult result = await _sut.AddStudentAsync(input); result.Should().NotBeNull(); result.ValidationMessages.Should().BeEquivalentTo(expectedValidationMessages); }
public async Task AddStudentAsync_UpdateSucceeds_ReturnsNoValidationMessages() { var input = _fixture.Create <AddStudentRequest>(); var studentValidationMessages = _fixture.CreateMany <ValidationMessage>(0); _studentValidator .Setup(x => x.ValidateRules(input)) .Returns(studentValidationMessages); var expectedClass = _fixture.Create <Class>(); _classRepository .Setup(x => x.GetAsync(input.ClassId)) .ReturnsAsync(expectedClass); _classRepository .Setup(x => x.UpdateAsync(expectedClass)) .ReturnsAsync((ValidationMessage)null); AddStudentResult result = await _sut.AddStudentAsync(input); result.Should().NotBeNull(); result.ValidationMessages.Should().BeEmpty(); }