Code generator improvements (#934)

* Handle new line escaping in C# mapping code generator

* Prevent date conversion when value persisted as string

* Handle object properties named as csharp keywords

* Refactor: Extract logic responsible for generating anonymous object definition to a separate class
This commit is contained in:
Cezary Piątek
2023-05-13 09:33:25 +02:00
committed by GitHub
parent 6ef116a295
commit 8444c8c506
4 changed files with 189 additions and 57 deletions

View File

@@ -36,7 +36,7 @@ server
.WithStatusCode(208)
.WithBodyAsJson(new
{
a = 1,
@as = 1,
b = 1.2,
d = true,
e = false,
@@ -59,7 +59,14 @@ server
b = 3
}
}
}
},
date_field = "2023-05-08T11:20:19",
string_field_with_date = "2021-03-13T21:04:00Z",
multiline_text = @"This
is
multiline
text
"
})
);

View File

@@ -762,7 +762,11 @@ public class WireMockAdminApiTests
.RespondWith(
Response.Create()
.WithStatusCode(HttpStatusCode.AlreadyReported)
.WithBodyAsJson(new { a = 1, b=1.2, d=true, e=false, f=new[]{1,2,3,4}, g= new{z1=1, z2=2, z3=new []{"a","b","c"}, z4=new[]{new {a=1, b=2},new {a=2, b=3}}} })
.WithBodyAsJson(new { @as = 1, b=1.2, d=true, e=false, f=new[]{1,2,3,4}, g= new{z1=1, z2=2, z3=new []{"a","b","c"}, z4=new[]{new {a=1, b=2},new {a=2, b=3}}}, date_field = new DateTime(2023,05,08,11,20,19), string_field_with_date="2021-03-13T21:04:00Z", multiline_text= @"This
is
multiline
text
" })
);
// Act