Skip to content

Commit 3b41c0b

Browse files
author
Joel W Kall
committed
added OpenApiWriterAnyExtensionsTests for double, float and long
1 parent 94409b8 commit 3b41c0b

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,51 @@ public void WriteOpenApiIntergerAsJsonWorks(int input)
3939
json.Should().Be(input.ToString());
4040
}
4141

42+
[Theory]
43+
[InlineData(-100)]
44+
[InlineData(0)]
45+
[InlineData(long.MaxValue)]
46+
public void WriteOpenApiLongAsJsonWorks(long input)
47+
{
48+
// Arrange
49+
var longValue = new OpenApiLong(input);
50+
51+
var json = WriteAsJson(longValue);
52+
53+
// Assert
54+
json.Should().Be(input.ToString());
55+
}
56+
57+
[Theory]
58+
[InlineData(-100.1)]
59+
[InlineData(0.0)]
60+
[InlineData(42.42)]
61+
public void WriteOpenApiFloatAsJsonWorks(float input)
62+
{
63+
// Arrange
64+
var floatValue = new OpenApiFloat(input);
65+
66+
var json = WriteAsJson(floatValue);
67+
68+
// Assert
69+
json.Should().Be(input.ToString());
70+
}
71+
72+
[Theory]
73+
[InlineData(-100.1)]
74+
[InlineData(0.0)]
75+
[InlineData(42.42)]
76+
public void WriteOpenApiDoubleAsJsonWorks(double input)
77+
{
78+
// Arrange
79+
var doubleValue = new OpenApiDouble(input);
80+
81+
var json = WriteAsJson(doubleValue);
82+
83+
// Assert
84+
json.Should().Be(input.ToString());
85+
}
86+
4287
[Theory]
4388
[InlineData(true)]
4489
[InlineData(false)]

0 commit comments

Comments
 (0)