public void CancelSanction(int sanctionId)
        {
            var currentSanction = _sanctionRepository.Get(sanctionId);

            currentSanction.Cancel();
            _sanctionRepository.Update(currentSanction);

            var username = _userRepository.GetUserById(currentSanction.UserId).UserProfile.Name;

            _publisher.PublishEvent(new SanctionCancelledEvent(currentSanction.BrokenRule, currentSanction.Type,
                                                               username, currentSanction.UserId));
        }
Beispiel #2
0
        public void CancelSanction_GetCanceledSanction()
        {
            //Arrange
            var sanctionFacade = new SanctionFacade(_sanctionRepository, _userRepository, _publisher.Object);
            var sanctionId     =
                sanctionFacade.AddSanction("some rule", _testUserId, _adminId, SanctionType.NotAllowToEditProfile);

            //Act
            sanctionFacade.CancelSanction(sanctionId);

            //Assert
            Assert.AreEqual(false, _sanctionRepository.Get(sanctionId).IsActive);
        }