Monday, June 20, 2016

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException using FluentAssertions

I was attempting to use FluentAssertions with my ASP.NET MVC project, when I encountered the following error message:

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'string' does not contain a definition for 'Should'

 I was essentially trying to execute the following code:


However, no matter what I did, I could not get this code to execute successfully!

Therefore, in the end, I ended up just using the standard MSTest assertions as follows:

Assert.AreEqual(expected, result.ViewBag.Message);

Unfortunately, that was the only viable solution for me. If you found an alternative solution, feel free to share your solution in the comments below!!

No comments:

Post a Comment