mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-04 14:40:53 +00:00
[C#][netcore] Add test for AdditionalProperties in both child and parent (#7921)
* add test for ap in both child and parent * add cat test to net47
This commit is contained in:
parent
e725c4e56f
commit
a3a0af7c84
@ -51,8 +51,9 @@ namespace Org.OpenAPITools.Test.Model
|
||||
[Fact]
|
||||
public void CatInstanceTest()
|
||||
{
|
||||
// TODO uncomment below to test "IsType" Cat
|
||||
//Assert.IsType<Cat>(instance);
|
||||
// test to ensure both Cat and Animal (parent) can have "AdditionalProperties", which result in warnings
|
||||
Cat c = JsonConvert.DeserializeObject<Cat>("{\"className\":\"cat\",\"bar\":\"from json bar\"}");
|
||||
Assert.Equal("from json bar", c.AdditionalProperties["bar"]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,11 +100,22 @@ namespace Org.OpenAPITools.Test
|
||||
/// ReadOnly property tests
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void ReadOnlyFruit()
|
||||
public void TestReadOnlyFruit()
|
||||
{
|
||||
ReadOnlyFirst r = JsonConvert.DeserializeObject<ReadOnlyFirst>("{\"baz\":\"from json gaz\",\"bar\":\"from json bar\"}");
|
||||
Assert.Equal("from json bar", r.Bar);
|
||||
Assert.Equal("{\"baz\":\"from json gaz\"}", JsonConvert.SerializeObject(r));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cat property tests
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestCat()
|
||||
{
|
||||
// test to ensure both Cat and Animal (parent) can have "AdditionalProperties", which result in warnings
|
||||
Cat c = JsonConvert.DeserializeObject<Cat>("{\"className\":\"cat\",\"bar\":\"from json bar\"}");
|
||||
Assert.Equal("from json bar", c.AdditionalProperties["bar"]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user