public void UrlEncodingWorks(bool use) { var ps = new ProtocolSettings().UseUrlEncode(use, use); var json = Helper.ReformatJson(Internal.GetProgramsResponseHelperSerializationTests.ValidJsonPlural); json = use ? System.Net.WebUtility.UrlEncode(json) : json; var value = LikePharmaClient.DeserializeJson <GetProgramsResponse>(json, ps, jsonSerializerOptions); Validate(value, "p"); var newJson = LikePharmaClient.SerializeJson(value, ps, jsonSerializerOptions); Assert.Equal(json, newJson); }
public void SerializeGetProgramsResponseAutomatically(bool singular, string expectedJson) { var ps = new ProtocolSettings() { SingularGetProgramsResponse = singular }; // вместо конструирования просто десериализуем, так проще var value = LikePharmaClient.DeserializeJson <GetProgramsResponse>(expectedJson, ps, jsonSerializerOptions); Validate(value, singular ? "s" : "p"); var newJson = LikePharmaClient.SerializeJson(value, ps, jsonSerializerOptions); Assert.Equal(Helper.ReformatJson(expectedJson), newJson); }