I'm writing a unit tests to verify filters are or are not present in the query based on various conditional logic. To test that my logic is working, I'm getting the request JSON from a mocked up in memory client. All this is working just fine.
What I'm stumbling on is that I don't want to hard code the name of the field that must be present in the JSON, I want to use the strongly typed attribute that is assigned to POCOs. However, I can't figure out a way to access the attribute outside of a query.
In sum, I want to be able to to something like this where I'm getting something from the field inference that I can use in the assertion.
Infer.Field<Product>(f => f.ColorIsNeutral);// how can I access the json name attribute from the field? Assert.Contains("color_is_neutral", requestJson); // I don't want this "magic string" in the assertion