示例#1
0
 public async Task AnalyzeWhenTooManyRequiredAndOptionalArgumentsAreProvided()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenTooManyRequiredAndOptionalArgumentsAreProvided))}.cs",
         new[] { AnalyzerIdentifiers.TestCaseUsage },
         diagnostics =>
     {
         var diagnostic = diagnostics[0];
         Assert.That(diagnostic.GetMessage(), Is.EqualTo(TestCaseUsageAnalyzerConstants.TooManyArgumentsMessage),
                     nameof(diagnostic.GetMessage));
     });
 }
示例#2
0
 public async Task AnalyzeWhenExpectedResultIsProvidedAndPassesNullToValueType()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedAndPassesNullToValueType))}.cs",
         new[] { AnalyzerIdentifiers.TestCaseUsage },
         diagnostics =>
     {
         var diagnostic = diagnostics[0];
         Assert.That(diagnostic.GetMessage(), Is.EqualTo(
                         string.Format(TestCaseUsageAnalyzerConstants.ExpectedResultTypeMismatchMessage, "Int32")),
                     nameof(diagnostic.GetMessage));
     });
 }
示例#3
0
 public async Task AnalyzeWhenExpectedResultIsProvidedAndReturnTypeIsVoid()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedAndReturnTypeIsVoid))}.cs",
         new[] { AnalyzerIdentifiers.TestCaseUsage },
         diagnostics =>
     {
         var diagnostic = diagnostics[0];
         Assert.That(diagnostic.GetMessage(), Is.EqualTo(
                         TestCaseUsageAnalyzerConstants.SpecifiedExpectedResultForVoidMethodMessage),
                     nameof(diagnostic.GetMessage));
     });
 }
示例#4
0
 public async Task AnalyzeWhenMethodHasOnlyParamsAndArgumentPassesNullToValueType()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenMethodHasOnlyParamsAndArgumentPassesNullToValueType))}.cs",
         new[] { AnalyzerIdentifiers.TestCaseUsage },
         diagnostics =>
     {
         var diagnostic = diagnostics[0];
         Assert.That(diagnostic.GetMessage(), Is.EqualTo(
                         string.Format(TestCaseUsageAnalyzerConstants.ParameterTypeMismatchMessage, "0", "a")),
                     nameof(diagnostic.GetMessage));
     });
 }
示例#5
0
 public async Task AnalyzeWhenArgumentIsAPrefixedValue()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentIsAPrefixedValue))}.cs",
         Array.Empty <string>());
 }
示例#6
0
 public async Task AnalyzeWhenAttributeHasNoArguments()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenAttributeHasNoArguments))}.cs",
         Array.Empty <string>());
 }
示例#7
0
 public async Task AnalyzeWhenExpectedResultIsProvidedAndPassesValueToNullableType()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedAndPassesValueToNullableType))}.cs",
         Array.Empty <string>());
 }
示例#8
0
 public async Task AnalyzeWhenExpectedResultIsProvidedCorrectly()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedCorrectly))}.cs",
         Array.Empty <string>());
 }
示例#9
0
 public async Task AnalyzeWhenMethodHasOnlyParamsAndArgumentTypeIsCorrect()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenMethodHasOnlyParamsAndArgumentTypeIsCorrect))}.cs",
         Array.Empty <string>());
 }
示例#10
0
 public async Task AnalyzeWhenMethodHasRequiredAndParamsAndMoreArgumentsThanParametersAreProvided()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenMethodHasRequiredAndParamsAndMoreArgumentsThanParametersAreProvided))}.cs",
         Array.Empty <string>());
 }
示例#11
0
 public async Task AnalyzeWhenArgumentPassesNullToNullableType()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentPassesNullToNullableType))}.cs",
         Array.Empty <string>());
 }
示例#12
0
 public async Task AnalyzeWhenArgumentIsAReferenceToConstant()
 {
     await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>(
         $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentIsAReferenceToConstant))}.cs",
         Array.Empty <string>());
 }