diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs index 99208a1d4..3d6362084 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs @@ -40,7 +40,7 @@ public static IList SplitByChar(this string target, char separator) { return new List(); } - return target.Split(new char[] { separator }, StringSplitOptions.RemoveEmptyEntries).ToList(); + return target.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries).ToList(); } } } diff --git a/src/Microsoft.OpenApi/Any/OpenApiByte.cs b/src/Microsoft.OpenApi/Any/OpenApiByte.cs index 88b0e178c..f28a50175 100644 --- a/src/Microsoft.OpenApi/Any/OpenApiByte.cs +++ b/src/Microsoft.OpenApi/Any/OpenApiByte.cs @@ -12,7 +12,7 @@ public class OpenApiByte : OpenApiPrimitive /// Initializes the class. /// public OpenApiByte(byte value) - : this(new byte[] { value }) + : this(new[] { value }) { } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b2b6b6c9b..fb451c1d8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -322,7 +322,7 @@ public void InvokeTransformCommand() { var rootCommand = Program.CreateRootCommand(); var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new string[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; + var args = new[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; var context = new InvocationContext(parseResult); @@ -339,7 +339,7 @@ public void InvokeShowCommand() { var rootCommand = Program.CreateRootCommand(); var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new string[] { "show", "-d", openApi, "-o", "sample.md" }; + var args = new[] { "show", "-d", openApi, "-o", "sample.md" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); @@ -355,7 +355,7 @@ public void InvokePluginCommand() { var rootCommand = Program.CreateRootCommand(); var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); - var args = new string[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; + var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler; var context = new InvocationContext(parseResult); diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs index f53beb8e3..784750ab6 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs @@ -22,7 +22,8 @@ public class OpenApiJsonWriterTests public static IEnumerable WriteStringListAsJsonShouldMatchExpectedTestCases() { return - from input in new string[][] { + from input in new[] + { new[] { "string1", @@ -234,7 +235,7 @@ public void WriteMapAsJsonShouldMatchExpected(IDictionary inputM public static IEnumerable WriteDateTimeAsJsonTestCases() { return - from input in new DateTimeOffset[] { + from input in new[] { new(2018, 1, 1, 10, 20, 30, TimeSpan.Zero), new(2018, 1, 1, 10, 20, 30, 100, TimeSpan.FromHours(14)), DateTimeOffset.UtcNow + TimeSpan.FromDays(4), diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs index 7c378c16f..05b57f4f3 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs @@ -40,7 +40,7 @@ public static IEnumerable IntInputs get { return - from input in new int[] { + from input in new[] { int.MinValue, 42, int.MaxValue, @@ -68,7 +68,7 @@ public static IEnumerable LongInputs get { return - from input in new long[] { + from input in new[] { long.MinValue, 42, long.MaxValue, @@ -96,7 +96,7 @@ public static IEnumerable FloatInputs get { return - from input in new float[] { + from input in new[] { float.MinValue, 42.42f, float.MaxValue, @@ -124,7 +124,7 @@ public static IEnumerable DoubleInputs get { return - from input in new double[] { + from input in new[] { double.MinValue, 42.42d, double.MaxValue,