From ddc11c359ca4ac3a83bdabe1f6ce7c7ce073dcca Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Mon, 22 Jan 2024 11:01:03 +0100 Subject: [PATCH] style updates to NotificationMethodGeneratorTest to make codeql happy --- .../Test/NotificationMethodGeneratorTest.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs index 0f33d7f23..eac8dd897 100644 --- a/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs +++ b/src/OpenRiaServices.Tools/Test/NotificationMethodGeneratorTest.cs @@ -2,7 +2,6 @@ using System.CodeDom; using System.Collections.Generic; using OpenRiaServices.Server; -using OpenRiaServices.Server.Test.Utilities; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -41,7 +40,7 @@ public static IEnumerable PartialMethodsSnippetBlockTestCases DynamicData(nameof(PartialMethodsSnippetBlockTestCases))] public void PartialMethodsSnippetBlockTest(string comments, string baseMethodNames, string parameters) { - string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); + string[] baseMethodNamesArray = baseMethodNames.Split(','); PartialMethodsSnippetBlockTest(true, comments, baseMethodNamesArray, parameters); PartialMethodsSnippetBlockTest(false, comments, baseMethodNamesArray, parameters); @@ -108,7 +107,7 @@ public static IEnumerable OnCreatedMethodInvokeExpressionTestCases ] public void GetMethodInvokeExpressionStatementForTest(string comments, string baseMethodNames, string parameters) { - string[] baseMethodNamesArray = baseMethodNames.Split(new char[] { ',' }); + string[] baseMethodNamesArray = baseMethodNames.Split(','); GetMethodInvokeExpressionStatementForTest(true, comments, baseMethodNamesArray, parameters); GetMethodInvokeExpressionStatementForTest(false, comments, baseMethodNamesArray, parameters); @@ -128,7 +127,7 @@ public void GetMethodInvokeExpressionStatementForTest(bool isCSharp, string comm target.AddMethodFor(baseMethodName, expressions, comments); CodeExpressionStatement actual = target.GetMethodInvokeExpressionStatementFor(baseMethodName); - CodeMethodInvokeExpression actualExpression = actual.Expression as CodeMethodInvokeExpression; + CodeMethodInvokeExpression actualExpression = (CodeMethodInvokeExpression)actual.Expression; Assert.AreEqual("On" + baseMethodName, actualExpression.Method.MethodName); @@ -188,7 +187,7 @@ public void AddMethodFor2Test(bool isCSharp, string comments, string paramDeclAr } else if (paramDeclArgs != "null") { - string[] args = paramDeclArgs.Split(new char[] { ',' }); + string[] args = paramDeclArgs.Split(','); parameterDeclaration = new CodeParameterDeclarationExpression(args[0], args[1]); } @@ -251,12 +250,12 @@ private static CodeParameterDeclarationExpressionCollection GetCodeParameterDecl { parameters = new CodeParameterDeclarationExpressionCollection(); - string[] paramDecls = paramDeclsArgs.Split(new char[] { ';' }); + string[] paramDecls = paramDeclsArgs.Split(';'); foreach (string paramDecl in paramDecls) { if (paramDecl != "") { - string[] args = paramDecl.Split(new char[] { ',' }); + string[] args = paramDecl.Split(','); Assert.AreEqual(2, args.Length, "Params definition file not in the correct format!"); CodeParameterDeclarationExpression codeParam = new CodeParameterDeclarationExpression(args[0], args[1]); parameters.Add(codeParam);