public void TestSpacingOfMethodAndProperty() { var test = @" namespace ConsoleApplication1 { class TypeName { /// <summary> /// main method. /// </summary> /// <param name=""args"">the arguments.</param> public static void Main(string args) { } public string VogonConstructorFleet { get; set; } } }"; var expected = new DiagnosticResult { Id = "SA1623D", Message = $"property documentation: no documentation.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 14, 23) } }; new DocumentationPropertyCodeFixVerifier().VerifyCSharpDiagnostic(test, expected); var fixtest = @" namespace ConsoleApplication1 { class TypeName { /// <summary> /// main method. /// </summary> /// <param name=""args"">the arguments.</param> public static void Main(string args) { } /// <summary> /// Gets or sets the vogon constructor fleet. /// </summary> public string VogonConstructorFleet { get; set; } } }"; new DocumentationPropertyCodeFixVerifier().VerifyCSharpFix(test, fixtest); }
public void TestThatBooleanPropertiesStartWithCorrectText() { var test = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { class TypeName { /// <summary> /// </summary> public bool TestProperty { get; set; } } }"; var expected = new DiagnosticResult { Id = "SA1623D", Message = $"property documentation: no documentation.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 15, 21) } }; this.VerifyCSharpDiagnostic(test, expected); var fixtest = @" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics; namespace ConsoleApplication1 { class TypeName { /// <summary> /// Gets or sets a value indicating whether test property. /// </summary> public bool TestProperty { get; set; } } }"; this.VerifyCSharpFix(test, fixtest); }
public void TestThatSpaceBeforeIsCorrectForSubsequentProperties() { var test = @" using System; namespace ConsoleApplication1 { class TypeName { /// <summary> /// some documentation. /// </summary> private int firstVariable; private Fleet[] _vogonConstructorFleet; } }"; var expected = new DiagnosticResult { Id = "SA1600D", Message = $"members must be correctly documented.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 11, 25) } }; new DocumentationMemberCodeFixVerifier().VerifyCSharpDiagnostic(test, expected); var fixtest = @" using System; namespace ConsoleApplication1 { class TypeName { /// <summary> /// some documentation. /// </summary> private int firstVariable; /// <summary> /// the vogon constructor fleet. /// </summary> private Fleet[] _vogonConstructorFleet; } }"; new DocumentationMemberCodeFixVerifier().VerifyCSharpFix(test, fixtest); }
public void TestDocumentSimpleMemberVariable() { var test = @" using System; namespace ConsoleApplication1 { class TypeName { private Fleet[] _vogonConstructorFleet; } }"; var expected = new DiagnosticResult { Id = "SA1600D", Message = $"members must be correctly documented.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 25) } }; new DocumentationMemberCodeFixVerifier().VerifyCSharpDiagnostic(test, expected); var fixtest = @" using System; namespace ConsoleApplication1 { class TypeName { /// <summary> /// the vogon constructor fleet. /// </summary> private Fleet[] _vogonConstructorFleet; } }"; new DocumentationMemberCodeFixVerifier().VerifyCSharpFix(test, fixtest); }
public void VerifyThatALongerTypeNameIsDocumentedCorrectly() { var test = @" using System; namespace ConsoleApplication1 { class TypeName { private readonly IReturnTypeWithProperName _properName; } }"; var expected = new DiagnosticResult { Id = "SA1600D", Message = $"members must be correctly documented.", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 52) } }; new DocumentationMemberCodeFixVerifier().VerifyCSharpDiagnostic(test, expected); var fixtest = @" using System; namespace ConsoleApplication1 { class TypeName { /// <summary> /// the return type with proper name. /// </summary> private readonly IReturnTypeWithProperName _properName; } }"; new DocumentationMemberCodeFixVerifier().VerifyCSharpFix(test, fixtest); }