Skip to content

Commit 789c807

Browse files
authored
make indents consistent (#1386)
1 parent 306dda2 commit 789c807

File tree

3 files changed

+397
-391
lines changed

3 files changed

+397
-391
lines changed

src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtension.cs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,34 @@ namespace Microsoft.OpenApi.MicrosoftExtensions;
1515
/// </summary>
1616
public class OpenApiPrimaryErrorMessageExtension : IOpenApiExtension
1717
{
18-
/// <summary>
19-
/// Name of the extension as used in the description.
20-
/// </summary>
21-
public static string Name => "x-ms-primary-error-message";
22-
/// <inheritdoc />
18+
/// <summary>
19+
/// Name of the extension as used in the description.
20+
/// </summary>
21+
public static string Name => "x-ms-primary-error-message";
22+
23+
/// <inheritdoc />
2324
public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
2425
{
25-
if(writer is null) throw new ArgumentNullException(nameof(writer));
26-
writer.WriteValue(IsPrimaryErrorMessage);
26+
if (writer is null) throw new ArgumentNullException(nameof(writer));
27+
writer.WriteValue(IsPrimaryErrorMessage);
2728
}
28-
/// <summary>
29-
/// Whether this property is the primary error message to use on error types.
30-
/// </summary>
31-
public bool IsPrimaryErrorMessage { get; set; }
32-
/// <summary>
29+
30+
/// <summary>
31+
/// Whether this property is the primary error message to use on error types.
32+
/// </summary>
33+
public bool IsPrimaryErrorMessage { get; set; }
34+
35+
/// <summary>
3336
/// Parses the <see cref="IOpenApiAny"/> to <see cref="OpenApiPrimaryErrorMessageExtension"/>.
3437
/// </summary>
3538
/// <param name="source">The source object.</param>
3639
/// <returns>The <see cref="OpenApiPrimaryErrorMessageExtension"/>.</returns>
37-
public static OpenApiPrimaryErrorMessageExtension Parse(IOpenApiAny source)
38-
{
39-
if (source is not OpenApiBoolean rawObject) throw new ArgumentOutOfRangeException(nameof(source));
40-
return new OpenApiPrimaryErrorMessageExtension
40+
public static OpenApiPrimaryErrorMessageExtension Parse(IOpenApiAny source)
41+
{
42+
if (source is not OpenApiBoolean rawObject) throw new ArgumentOutOfRangeException(nameof(source));
43+
return new OpenApiPrimaryErrorMessageExtension
4144
{
42-
IsPrimaryErrorMessage = rawObject.Value
43-
};
44-
}
45+
IsPrimaryErrorMessage = rawObject.Value
46+
};
47+
}
4548
}

test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtensionTests.cs

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,47 @@ namespace Microsoft.OpenApi.OData.OpenApiExtensions.Tests;
1212

1313
public class OpenApiPrimaryErrorMessageExtensionTests
1414
{
15-
[Fact]
16-
public void ExtensionNameMatchesExpected()
17-
{
18-
// Act
19-
string name = OpenApiPrimaryErrorMessageExtension.Name;
20-
string expectedName = "x-ms-primary-error-message";
21-
22-
// Assert
23-
Assert.Equal(expectedName, name);
24-
}
25-
[Fact]
26-
public void WritesValue()
27-
{
28-
// Arrange
29-
OpenApiPrimaryErrorMessageExtension extension = new() {
30-
IsPrimaryErrorMessage = true
31-
};
32-
using TextWriter sWriter = new StringWriter();
33-
OpenApiJsonWriter writer = new(sWriter);
34-
35-
// Act
36-
extension.Write(writer, OpenApiSpecVersion.OpenApi3_0);
37-
string result = sWriter.ToString();
38-
39-
// Assert
40-
Assert.True(extension.IsPrimaryErrorMessage);
41-
Assert.Equal("true", result);
42-
}
43-
[Fact]
44-
public void ParsesValue()
45-
{
46-
// Arrange
47-
var value = new OpenApiBoolean(true);
48-
49-
// Act
50-
var extension = OpenApiPrimaryErrorMessageExtension.Parse(value);
51-
52-
// Assert
53-
Assert.True(extension.IsPrimaryErrorMessage);
54-
}
15+
[Fact]
16+
public void ExtensionNameMatchesExpected()
17+
{
18+
// Act
19+
string name = OpenApiPrimaryErrorMessageExtension.Name;
20+
string expectedName = "x-ms-primary-error-message";
21+
22+
// Assert
23+
Assert.Equal(expectedName, name);
24+
}
25+
26+
[Fact]
27+
public void WritesValue()
28+
{
29+
// Arrange
30+
OpenApiPrimaryErrorMessageExtension extension = new()
31+
{
32+
IsPrimaryErrorMessage = true
33+
};
34+
using TextWriter sWriter = new StringWriter();
35+
OpenApiJsonWriter writer = new(sWriter);
36+
37+
// Act
38+
extension.Write(writer, OpenApiSpecVersion.OpenApi3_0);
39+
string result = sWriter.ToString();
40+
41+
// Assert
42+
Assert.True(extension.IsPrimaryErrorMessage);
43+
Assert.Equal("true", result);
44+
}
45+
46+
[Fact]
47+
public void ParsesValue()
48+
{
49+
// Arrange
50+
var value = new OpenApiBoolean(true);
51+
52+
// Act
53+
var extension = OpenApiPrimaryErrorMessageExtension.Parse(value);
54+
55+
// Assert
56+
Assert.True(extension.IsPrimaryErrorMessage);
57+
}
5558
}

0 commit comments

Comments
 (0)