public async Task Return_Errors_When_Validation_Fails() { //Arrange const string warning = "You cannot update Category"; var logic = Create(); await CategoryValidator.SetValidatorFailure(warning); //Act var result = await logic.Update(Category); //Assert result.Should() .BeFailure(warning); CategoryValidator.Verify(v => v.ValidateAsync(Category, It.IsAny <CancellationToken>()), Times.Once()); Repository.Verify(r => r.SaveChanges(), Times.Never); }