public void SingleClassWithFilledSummary() { string fileContent = Util.GetFileContent("Single class with filled summary.txt"); PolicyConfig config = new PolicyConfig().LoadDefaults(); ViolationStore violationStore = new CodeCommentsFacade().CheckCodeDocumentation(fileContent, config); Assert.IsFalse(violationStore.HasViolations); }
public void SingleClassWithEmptySummary() { string fileContent = Util.GetFileContent("Single class with empty summary.txt"); PolicyConfig config = new PolicyConfig().LoadDefaults(); ViolationStore violationStore = new CodeCommentsFacade().CheckCodeDocumentation(fileContent, config); List <Violation> violations = violationStore.Violations.ToList(); Assert.AreEqual(1, violations.Count); Violation classViolation = violations.First(); Assert.AreEqual(Constants.MissingSummaryMessage, classViolation.Message); Assert.AreEqual("CDCP.Tests.SampleCode.Test1", classViolation.FullSymbolName); }
public void SingleProtectedInternalPropertyWithNoSummary() { string fileContent = Util.GetFileContent("Properties.P1_No_Summary_ProtectedInternal.cs"); PolicyConfig config = GetDeactivatedConfig(); config.PropertyConfig.SummaryDocumentationRequired = true; config.PropertyConfig.VisibilitiesToCheck = new HashSet <Visibility> { Visibility.ProtectedInternal }; ViolationStore violationStore = new CodeCommentsFacade().CheckCodeDocumentation(fileContent, config); Assert.IsTrue(violationStore.HasViolations); Assert.AreEqual(1, violationStore.Violations.Count()); Violation violation = violationStore.Violations.First(); Assert.AreEqual(8, violation.Line); Assert.AreEqual(31, violation.Column); Assert.AreEqual("Name", violation.SymbolName); }