public void VerifyAnnouncementPreferenceLimitCanBeChanged_Should_Return_VerificationResult_With_Success_True() { _authorizationServiceMock.Setup(x => x.IsAdministrator()).Returns(true); var expectedResult = VerificationResult.Ok(); var result = _service.VerifyAnnouncementPreferenceLimitCanBeChanged(); result.Should().BeEquivalentTo(expectedResult); }
private void UpdateAnnouncementPreferenceLimit(User user, int announcementPreferenceLimit, Guid correlationId) { if (user.AnnouncementPreferenceLimit != announcementPreferenceLimit) { var announcementPreferenceLimitCanBeChangedVerificationResult = _userVerificationService.VerifyAnnouncementPreferenceLimitCanBeChanged(); if (!announcementPreferenceLimitCanBeChangedVerificationResult.Success) { throw new ValidationException(announcementPreferenceLimitCanBeChangedVerificationResult.Errors); } user.ChangeAnnouncementPreferenceLimit(announcementPreferenceLimit, correlationId); } }