private void Serialize <TThing>() where TThing : Thing, new() { var thing = new TThing(); var context = Factory.Create(thing, new ThingOption()); var message = JsonSerializer.Serialize(context.Response, new ThingOption().ToJsonSerializerOptions()); FluentAssertions.Json.JsonAssertionExtensions.Should(JToken.Parse(message)) .BeEquivalentTo(JToken.Parse(RESPONSE.Replace("{0}", thing.Name))); }
private void Serialize <TThing>() where TThing : Thing, new() { var thing = new TThing(); var context = Factory.Create(thing, new ThingOption()); var message = JsonSerializer.Serialize(context.Response, new ThingOption().ToJsonSerializerOptions()); var value = typeof(T).IsEnum ? $@", ""enum"": [""{string.Join(@""" , """, typeof(T).GetEnumNames())}""]" : string.Empty; FluentAssertions.Json.JsonAssertionExtensions.Should(JToken.Parse(message)) .BeEquivalentTo(JToken.Parse(string.Format(Response, thing.Name, typeof(T).ToJsonType().ToString().ToLower(), value))); }