public void IntegerConstantsMustNotBeAffectedByDiagnostics() { var testProgram = TestAssetsReader.ReadTestAsset("IntegerConstant.cs"); var expectedDiagnostics = new DiagnosticResult[0]; VerifyCSharpDiagnostic(testProgram, expectedDiagnostics); }
public void MultiplicationDiagnosticsWithVariablesMustBeFixable() { var badProgram = TestAssetsReader.ReadTestAsset("MultiplicationsWithVariables.cs"); var fixedProgram = TestAssetsReader.ReadTestAsset("MultiplicationsWithVariablesFixed.cs"); VerifyCSharpFix(badProgram, fixedProgram); }
public void ASimpleMultiplicationForbiddenDiagnosticMustBeFixable() { var badProgram = TestAssetsReader.ReadTestAsset("SimpleMultiplication.cs"); var fixedProgram = TestAssetsReader.ReadTestAsset("SimpleMultiplicationFixed.cs"); VerifyCSharpFix(badProgram, fixedProgram); }
public void AMultiplicationAssignmentForbiddenDiagnosticMustBeFixable() { var badProgram = TestAssetsReader.ReadTestAsset("MultiplicationAssignment.cs"); var fixedProgram = TestAssetsReader.ReadTestAsset("MultiplicationAssignmentFixed.cs"); VerifyCSharpFix(badProgram, fixedProgram); }
public void FloatLiteralsMustBeInvalidated() { var testProgram = TestAssetsReader.ReadTestAsset("FloatLiteral.cs"); var expectedDiagnostic = new DiagnosticResult { Id = "NES002", Message = "Rework your code to not depend on float nor double", Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 41) } }; VerifyCSharpDiagnostic(testProgram, expectedDiagnostic); }
public void CallsToMethodsReturningDoubleMustBeInvalidated() { var testProgram = TestAssetsReader.ReadTestAsset("DoubleMethodCall.cs"); var expectedDiagnostic = new DiagnosticResult { Id = "NES001", Message = "Do not invoke methods that return Double", Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 23) } }; VerifyCSharpDiagnostic(testProgram, expectedDiagnostic); }
public void CodeWithMultiplicationAssignmentsMustTriggerAnErrorDiagnostic() { var testProgram = TestAssetsReader.ReadTestAsset("MultiplicationAssignment.cs"); var multiplicationAssignmentDiagnostic = new DiagnosticResult { Id = "NES003", Message = "Use bit-shifting multiplication or NESMath.Multiply to multiply two numbers with an algorithm that can be run on the NES CPU", Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 8, 13) } }; VerifyCSharpDiagnostic(testProgram, multiplicationAssignmentDiagnostic); }
public void FloatMethodReturnsAndParametersMustBeInvalidated() { var testProgram = TestAssetsReader.ReadTestAsset("FloatMethodDeclaration.cs"); var expectedDiagnostics = new [] { new DiagnosticResult { Id = "NES002", Message = "Rework your code to not depend on float nor double", Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 10) } }, new DiagnosticResult { Id = "NES002", Message = "Rework your code to not depend on float nor double", Severity = DiagnosticSeverity.Error, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 7, 33) } } }; VerifyCSharpDiagnostic(testProgram, expectedDiagnostics); }