public async Task Write_throws_on_invalid_comment( Comment comment, List <ValidationError> errors, Mock <ICommentValidator> validator, Mock <ICommentWriter> writer) { validator.Setup(v => v.Validate(comment)).Returns(errors); var sut = new ValidatedWriter(validator.Object, writer.Object); await Assert.ThrowsAsync <ValidationException>(() => sut.Write(comment)); }
public async Task Write_calls_inner_writer( Comment comment, Mock <ICommentValidator> validator, Mock <ICommentWriter> writer) { var sut = new ValidatedWriter(validator.Object, writer.Object); await sut.Write(comment); writer.Verify(w => w.Write(comment), Times.Exactly(1)); }