public async Task accepts_role(UserRoleEnum role) { var sut = new ChangeUserRoleValidator(); var result = await sut.ValidateAsync( new ChangeUserRoleRequest { UserId = 1, Role = role } ); result.IsValid.Should().BeTrue(); }
public async Task fails_on_role(UserRoleEnum role) { var sut = new ChangeUserRoleValidator(); var result = await sut.ValidateAsync( new ChangeUserRoleRequest { UserId = 1, Role = role } ); result.IsValid.Should().BeFalse(); result.Errors.Should().Contain(x => x.PropertyName == nameof(ChangeUserRoleRequest.Role)); }