public void ViolationListControllerShouldIgnoreFileAndRemoveViolationsFromViolationListOnViewIgnoreViolationFile() { RuleViolation violation = new RuleViolation("file.cs", null, new List <TokenBase>()); Expect.Call(() => _projectModel.IgnoredFile("file.cs")).Repeat.Once(); Mocker.ReplayAll(); _controller = new ViolationListController(_view, _projectModel, _violationList); _view.Raise(x => x.IgnoreViolation += null, this, new RuleViolationIgnoreCommandEventArgs(violation, RuleViolationIgnoreType.File)); Mocker.VerifyAll(); }
private void _view_IgnoreViolation(object sender, RuleViolationIgnoreCommandEventArgs e) { switch (e.IgnoreType) { case RuleViolationIgnoreType.File: _project.IgnoredFile(e.Violation.File); foreach (RuleViolation aViolation in new List <RuleViolation>(_violationList)) { if (aViolation.File.Equals(e.Violation.File)) { _violationList.Remove(aViolation); } } break; default: throw new CalidusException("Unrecognized ignore type " + e.IgnoreType); } }