From 0c9ee09804baf88eccca2312cb25e15dc87c5425 Mon Sep 17 00:00:00 2001 From: PerthCharern Date: Fri, 15 Dec 2017 13:57:44 -0800 Subject: [PATCH 1/3] - V2 doc parameter in can be "formData", not just "form". - Basic unit tests for 5 types of possible parameters in V2. --- .../OpenApiV2ReferenceService.cs | 1 + .../V2/OpenApiParameterDeserializer.cs | 6 +- .../Microsoft.OpenApi.Readers.Tests.csproj | 15 ++ .../V2Tests/OpenApiParameterTests.cs | 180 ++++++++++++++++++ .../OpenApiParameter/bodyParameter.yaml | 9 + .../OpenApiParameter/formDataParameter.yaml | 6 + .../OpenApiParameter/headerParameter.yaml | 10 + .../OpenApiParameter/pathParameter.yaml | 6 + .../OpenApiParameter/queryParameter.yaml | 9 + 9 files changed, 240 insertions(+), 2 deletions(-) create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/bodyParameter.yaml create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/formDataParameter.yaml create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/headerParameter.yaml create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/pathParameter.yaml create mode 100644 test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/queryParameter.yaml diff --git a/src/Microsoft.OpenApi.Readers/ReferenceServices/OpenApiV2ReferenceService.cs b/src/Microsoft.OpenApi.Readers/ReferenceServices/OpenApiV2ReferenceService.cs index 361f76275..0769f20d4 100644 --- a/src/Microsoft.OpenApi.Readers/ReferenceServices/OpenApiV2ReferenceService.cs +++ b/src/Microsoft.OpenApi.Readers/ReferenceServices/OpenApiV2ReferenceService.cs @@ -97,6 +97,7 @@ public bool TryLoadReference(OpenApiReference reference, out IOpenApiReferenceab break; case ReferenceType.Parameter: + // TODO: Handle referencing to a "body" parameter in V2 referencedObject = OpenApiV2Deserializer.LoadParameter(node); break; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs index b06bbec4b..8799a13f5 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs @@ -202,13 +202,14 @@ private static void ProcessIn(OpenApiParameter o, ParseNode n) case "body": n.Context.SetTempStorage("bodyParameter", o); break; - case "form": + case "formData": var formParameters = n.Context.GetFromTempStorage>("formParameters"); if (formParameters == null) { formParameters = new List(); n.Context.SetTempStorage("formParameters", formParameters); } + formParameters.Add(o); break; default: @@ -226,11 +227,12 @@ public static OpenApiParameter LoadParameter(ParseNode node) var mapNode = node.CheckMapNode("parameter"); var pointer = mapNode.GetReferencePointer(); + if (pointer != null) { return mapNode.GetReferencedObject(ReferenceType.Parameter, pointer); } - + var parameter = new OpenApiParameter(); ParseMap(mapNode, parameter, _parameterFixedFields, _parameterPatternFields); diff --git a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj index eb24f2ba5..8b8fc6f8e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj +++ b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj @@ -65,6 +65,21 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs new file mode 100644 index 000000000..dddd02248 --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.IO; +using System.Linq; +using FluentAssertions; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Readers.ParseNodes; +using Microsoft.OpenApi.Readers.V2; +using SharpYaml.Serialization; +using Xunit; + +namespace Microsoft.OpenApi.Readers.Tests.V2Tests +{ + [Collection("DefaultSettings")] + public class OpenApiParameterTests + { + private const string SampleFolderPath = "V2Tests/Samples/OpenApiParameter"; + + [Fact] + public void ParseBodyParameterShouldSucceed() + { + using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "bodyParameter.yaml"))) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + // Body parameter is currently not translated via LoadParameter. + // This design may be revisited and this unit test may likely change. + parameter.ShouldBeEquivalentTo(null); + } + } + + [Fact] + public void ParsePathParameterShouldSucceed() + { + using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "pathParameter.yaml"))) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Path, + Name = "username", + Description = "username to fetch", + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + } + }); + } + } + + [Fact] + public void ParseQueryParameterShouldSucceed() + { + using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "queryParameter.yaml"))) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Query, + Name = "id", + Description = "ID of the object to fetch", + Required = false, + Schema = new OpenApiSchema() + { + Type = "array", + Items = new OpenApiSchema() + { + Type = "string" + } + }, + Style = ParameterStyle.Form, + Explode = true + }); + } + } + + [Fact] + public void ParseFormDataParameterShouldSucceed() + { + using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "formDataParameter.yaml"))) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + // Form data parameter is currently not translated via LoadParameter. + // This design may be revisited and this unit test may likely change. + parameter.ShouldBeEquivalentTo(null); + } + } + + [Fact] + public void ParseHeaderParameterShouldSucceed() + { + using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "headerParameter.yaml"))) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Header, + Name = "token", + Description = "token to be passed as a header", + Required = true, + Style = ParameterStyle.Simple, + Schema = new OpenApiSchema() + { + Type = "array", + Items = new OpenApiSchema() + { + Type = "integer", + Format = "int64" + } + } + }); + } + } + } +} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/bodyParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/bodyParameter.yaml new file mode 100644 index 000000000..d4c0664de --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/bodyParameter.yaml @@ -0,0 +1,9 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject +name: user +in: body +description: user to add to the system +required: true +schema: + type: array + items: + type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/formDataParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/formDataParameter.yaml new file mode 100644 index 000000000..7b148968d --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/formDataParameter.yaml @@ -0,0 +1,6 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject +name: avatar +in: formData +description: The avatar of the user +required: true +type: file \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/headerParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/headerParameter.yaml new file mode 100644 index 000000000..c3e56f0e2 --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/headerParameter.yaml @@ -0,0 +1,10 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject +name: token +in: header +description: token to be passed as a header +required: true +type: array +items: + type: integer + format: int64 +collectionFormat: csv \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/pathParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/pathParameter.yaml new file mode 100644 index 000000000..8d02be56b --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/pathParameter.yaml @@ -0,0 +1,6 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject +name: username +in: path +description: username to fetch +required: true +type: string \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/queryParameter.yaml b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/queryParameter.yaml new file mode 100644 index 000000000..8389caee3 --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/Samples/OpenApiParameter/queryParameter.yaml @@ -0,0 +1,9 @@ +# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#parameterObject +name: id +in: query +description: ID of the object to fetch +required: false +type: array +items: + type: string +collectionFormat: multi \ No newline at end of file From 5aa1dc889cfa2cab778e5fa3cc67e0bc8fc1ee66 Mon Sep 17 00:00:00 2001 From: PerthCharern Date: Fri, 15 Dec 2017 14:51:42 -0800 Subject: [PATCH 2/3] - Add TestHelper and move redundant code there --- .../TestHelper.cs | 25 +++ .../V2Tests/OpenApiParameterTests.cs | 201 ++++++++---------- 2 files changed, 111 insertions(+), 115 deletions(-) create mode 100644 test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs diff --git a/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs b/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs new file mode 100644 index 000000000..0124d1a7f --- /dev/null +++ b/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.IO; +using System.Linq; +using Microsoft.OpenApi.Readers.ParseNodes; +using SharpYaml.Serialization; + +namespace Microsoft.OpenApi.Readers.Tests +{ + internal class TestHelper + { + public static MapNode CreateYamlMapNode(Stream stream) + { + var yamlStream = new YamlStream(); + yamlStream.Load(new StreamReader(stream)); + var yamlNode = yamlStream.Documents.First().RootNode; + + var context = new ParsingContext(); + var diagnostic = new OpenApiDiagnostic(); + + return new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + } + } +} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs index dddd02248..a90454d96 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.IO; -using System.Linq; using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers.ParseNodes; using Microsoft.OpenApi.Readers.V2; -using SharpYaml.Serialization; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V2Tests @@ -21,160 +18,134 @@ public class OpenApiParameterTests [Fact] public void ParseBodyParameterShouldSucceed() { + MapNode node; + // Arrange using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "bodyParameter.yaml"))) { - var yamlStream = new YamlStream(); - yamlStream.Load(new StreamReader(stream)); - var yamlNode = yamlStream.Documents.First().RootNode; - - var context = new ParsingContext(); - var diagnostic = new OpenApiDiagnostic(); - - var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + node = TestHelper.CreateYamlMapNode(stream); + } - // Act - var parameter = OpenApiV2Deserializer.LoadParameter(node); + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); - // Assert - // Body parameter is currently not translated via LoadParameter. - // This design may be revisited and this unit test may likely change. - parameter.ShouldBeEquivalentTo(null); - } + // Assert + // Body parameter is currently not translated via LoadParameter. + // This design may be revisited and this unit test may likely change. + parameter.ShouldBeEquivalentTo(null); } [Fact] public void ParsePathParameterShouldSucceed() { + MapNode node; + // Arrange using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "pathParameter.yaml"))) { - var yamlStream = new YamlStream(); - yamlStream.Load(new StreamReader(stream)); - var yamlNode = yamlStream.Documents.First().RootNode; - - var context = new ParsingContext(); - var diagnostic = new OpenApiDiagnostic(); - - var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); - - // Act - var parameter = OpenApiV2Deserializer.LoadParameter(node); + node = TestHelper.CreateYamlMapNode(stream); + } - // Assert - parameter.ShouldBeEquivalentTo( - new OpenApiParameter + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Path, + Name = "username", + Description = "username to fetch", + Required = true, + Schema = new OpenApiSchema { - In = ParameterLocation.Path, - Name = "username", - Description = "username to fetch", - Required = true, - Schema = new OpenApiSchema() - { - Type = "string" - } - }); - } + Type = "string" + } + }); } [Fact] public void ParseQueryParameterShouldSucceed() { + MapNode node; + // Arrange using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "queryParameter.yaml"))) { - var yamlStream = new YamlStream(); - yamlStream.Load(new StreamReader(stream)); - var yamlNode = yamlStream.Documents.First().RootNode; - - var context = new ParsingContext(); - var diagnostic = new OpenApiDiagnostic(); - - var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); - - // Act - var parameter = OpenApiV2Deserializer.LoadParameter(node); - - // Assert - parameter.ShouldBeEquivalentTo( - new OpenApiParameter + node = TestHelper.CreateYamlMapNode(stream); + } + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Query, + Name = "id", + Description = "ID of the object to fetch", + Required = false, + Schema = new OpenApiSchema { - In = ParameterLocation.Query, - Name = "id", - Description = "ID of the object to fetch", - Required = false, - Schema = new OpenApiSchema() + Type = "array", + Items = new OpenApiSchema { - Type = "array", - Items = new OpenApiSchema() - { - Type = "string" - } - }, - Style = ParameterStyle.Form, - Explode = true - }); - } + Type = "string" + } + }, + Style = ParameterStyle.Form, + Explode = true + }); } [Fact] public void ParseFormDataParameterShouldSucceed() { + MapNode node; + // Arrange using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "formDataParameter.yaml"))) { - var yamlStream = new YamlStream(); - yamlStream.Load(new StreamReader(stream)); - var yamlNode = yamlStream.Documents.First().RootNode; - - var context = new ParsingContext(); - var diagnostic = new OpenApiDiagnostic(); - - var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); + node = TestHelper.CreateYamlMapNode(stream); + } - // Act - var parameter = OpenApiV2Deserializer.LoadParameter(node); + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); - // Assert - // Form data parameter is currently not translated via LoadParameter. - // This design may be revisited and this unit test may likely change. - parameter.ShouldBeEquivalentTo(null); - } + // Assert + // Form data parameter is currently not translated via LoadParameter. + // This design may be revisited and this unit test may likely change. + parameter.ShouldBeEquivalentTo(null); } [Fact] public void ParseHeaderParameterShouldSucceed() { + MapNode node; + // Arrange using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "headerParameter.yaml"))) { - var yamlStream = new YamlStream(); - yamlStream.Load(new StreamReader(stream)); - var yamlNode = yamlStream.Documents.First().RootNode; - - var context = new ParsingContext(); - var diagnostic = new OpenApiDiagnostic(); - - var node = new MapNode(context, diagnostic, (YamlMappingNode)yamlNode); - - // Act - var parameter = OpenApiV2Deserializer.LoadParameter(node); + node = TestHelper.CreateYamlMapNode(stream); + } - // Assert - parameter.ShouldBeEquivalentTo( - new OpenApiParameter + // Act + var parameter = OpenApiV2Deserializer.LoadParameter(node); + + // Assert + parameter.ShouldBeEquivalentTo( + new OpenApiParameter + { + In = ParameterLocation.Header, + Name = "token", + Description = "token to be passed as a header", + Required = true, + Style = ParameterStyle.Simple, + Schema = new OpenApiSchema { - In = ParameterLocation.Header, - Name = "token", - Description = "token to be passed as a header", - Required = true, - Style = ParameterStyle.Simple, - Schema = new OpenApiSchema() + Type = "array", + Items = new OpenApiSchema { - Type = "array", - Items = new OpenApiSchema() - { - Type = "integer", - Format = "int64" - } + Type = "integer", + Format = "int64" } - }); - } + } + }); } } } \ No newline at end of file From 40d19248a0b7f03e32c74facec33a03b789f81b5 Mon Sep 17 00:00:00 2001 From: PerthCharern Date: Fri, 15 Dec 2017 14:53:26 -0800 Subject: [PATCH 3/3] Style changes --- .../V2Tests/OpenApiParameterTests.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs index a90454d96..2002993c4 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs @@ -18,8 +18,8 @@ public class OpenApiParameterTests [Fact] public void ParseBodyParameterShouldSucceed() { - MapNode node; // Arrange + MapNode node; using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "bodyParameter.yaml"))) { node = TestHelper.CreateYamlMapNode(stream); @@ -37,8 +37,8 @@ public void ParseBodyParameterShouldSucceed() [Fact] public void ParsePathParameterShouldSucceed() { - MapNode node; // Arrange + MapNode node; using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "pathParameter.yaml"))) { node = TestHelper.CreateYamlMapNode(stream); @@ -65,12 +65,13 @@ public void ParsePathParameterShouldSucceed() [Fact] public void ParseQueryParameterShouldSucceed() { - MapNode node; // Arrange + MapNode node; using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "queryParameter.yaml"))) { node = TestHelper.CreateYamlMapNode(stream); } + // Act var parameter = OpenApiV2Deserializer.LoadParameter(node); @@ -98,8 +99,8 @@ public void ParseQueryParameterShouldSucceed() [Fact] public void ParseFormDataParameterShouldSucceed() { - MapNode node; // Arrange + MapNode node; using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "formDataParameter.yaml"))) { node = TestHelper.CreateYamlMapNode(stream); @@ -117,8 +118,8 @@ public void ParseFormDataParameterShouldSucceed() [Fact] public void ParseHeaderParameterShouldSucceed() { - MapNode node; // Arrange + MapNode node; using (var stream = File.OpenRead(Path.Combine(SampleFolderPath, "headerParameter.yaml"))) { node = TestHelper.CreateYamlMapNode(stream);