I am using XUnit and fluentassertions in c sharp for my unit tests. Below is where I get a dynamic type, convert a dynamic object to that dynamic type and try to do an assertion:
var dynamicType = Type.GetType(...);
dynamic? myObject = JsonSerializer.Deserialize(myJSONData, dynamicType);
myObject!.Products!.Should().NotBeNull();
If I debug it, myObject does have the required properties and values, however c sharp and fluentassertion throw this error:
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : 'xxxxx.Products' does not contain a definition for 'Should'
Is it possible to do the comparison or did I miss out anything?