public async Task MissingInterfaceImplementationMember() { var test = @" public interface A { void Foo(); } public class Parent : A { // This class intentionally does not implement the interface } internal class Child : Parent { public Child() { } } "; var expected = Verify.CompilerError("CS0535").WithLocation(6, 23).WithMessage("'Parent' does not implement interface member 'A.Foo()'"); await Verify.VerifyAnalyzerAsync(test, expected); }
public async Task MissingInterfaceImplementationMember() { var test = @" public interface A { void Foo(); } public class Parent : A { // This class intentionally does not implement the interface } internal class Child : Parent { public Child() { } } "; DiagnosticResult expected = Verify.CompilerError("CS0535").WithLocation(6, 23).WithArguments("Parent", "A.Foo()"); await Verify.VerifyAnalyzerAsync(test, expected); }
public async Task MissingTypeObjectCreationSyntax() { var test = @" using System; public class A { public void B() { var c = new C(); } internal void C() { var c = new C(); } } "; DiagnosticResult[] expected = { Verify.CompilerError("CS0246").WithLocation(6, 21).WithMessage("The type or namespace name 'C' could not be found (are you missing a using directive or an assembly reference?)"), Verify.CompilerError("CS0246").WithLocation(10, 21).WithMessage("The type or namespace name 'C' could not be found (are you missing a using directive or an assembly reference?)"), }; await Verify.VerifyAnalyzerAsync(test, expected); }
public async Task MissingTypeObjectCreationSyntax() { var test = @" using System; public class A { public void B() { var c = new C(); } internal void C() { var c = new C(); } } "; DiagnosticResult[] expected = { Verify.CompilerError("CS0246").WithLocation(6, 21).WithArguments("C"), Verify.CompilerError("CS0246").WithLocation(10, 21).WithArguments("C"), }; await Verify.VerifyAnalyzerAsync(test, expected); }