You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 19, 2024. It is now read-only.
Given a class with an enum the assertion fails if you convert the entity to json to get the post body, e.g.
[TestMethod]
public void PackagePost()
{
var package = new Package();
var packageJson = JsonConvert.SerializeObject(package);
config.ShouldMap("/api/Package")
.WithJsonBody(packageJson)
.To<PackageController>(HttpMethod.Post, x => x.Post(package));
}
[TestMethod]
public void PackagePostJson2()
{
var package = new Package();
var packageJson = "{ Logging: 'Basic', Synchronous: 'false' }";
config.ShouldMap("/api/Package")
.WithJsonBody(packageJson)
.To<PackageController>(HttpMethod.Post, x => x.Post(package));
}
The issue is that the PropertyReader.GetPropertyValue gets the enum representation rather than the json representation of the value so it fails as 'Basic' != 1.
Sorry for the incomplete repro but this should give the basic idea of the issue.
Given a class with an enum the assertion fails if you convert the entity to json to get the post body, e.g.
The issue is that the PropertyReader.GetPropertyValue gets the enum representation rather than the json representation of the value so it fails as 'Basic' != 1.
Sorry for the incomplete repro but this should give the basic idea of the issue.