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)); }); }
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)); }); }
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)); }); }
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)); }); }
public async Task AnalyzeWhenArgumentIsAPrefixedValue() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentIsAPrefixedValue))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenAttributeHasNoArguments() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenAttributeHasNoArguments))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenExpectedResultIsProvidedAndPassesValueToNullableType() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedAndPassesValueToNullableType))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenExpectedResultIsProvidedCorrectly() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenExpectedResultIsProvidedCorrectly))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenMethodHasOnlyParamsAndArgumentTypeIsCorrect() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenMethodHasOnlyParamsAndArgumentTypeIsCorrect))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenMethodHasRequiredAndParamsAndMoreArgumentsThanParametersAreProvided() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenMethodHasRequiredAndParamsAndMoreArgumentsThanParametersAreProvided))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenArgumentPassesNullToNullableType() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentPassesNullToNullableType))}.cs", Array.Empty <string>()); }
public async Task AnalyzeWhenArgumentIsAReferenceToConstant() { await TestHelpers.RunAnalysisAsync <TestCaseUsageAnalyzer>( $"{TestCaseUsageAnalyzerTests.BasePath}{(nameof(this.AnalyzeWhenArgumentIsAReferenceToConstant))}.cs", Array.Empty <string>()); }