New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DLR/dynamic support #234
Comments
Not until C# supports calling extension methods from dynamic objects... |
Usually dynamic users can still utilize Extension Methods by calling them as static methods. Can anything reasonably be changed internally in FA to support this? As is a string d = "hi";
AssertionExtensions.Should(d).Be("yo"); Given a number of the recent .NET targets do not support Since NUnit's |
@vossad01 But what should |
Can't you use the equality operator, like in |
Is it not possible to use dynamic set = GetDynamic();
set.As<int>().Should().Be(6); Looks better than: dynamic set = GetDynamic();
((int)set).Should().Be(6); |
@mpodonyi That |
The situation will be a bit better with 5.0 because the object being compared with will be what is used to traverse the object graph instead of the SUT. |
Has anything now changed with 5.0? (I need to test dynamic objects with a REST api) |
Unless there's a way to define a |
I am using cast to object as a workaround, but where I am specifically wanting to test the type of a dynamic e.g. // field.value is dynamic
field.value = "xyz";
((object)field.value).Should().BeOfType(typeof(string)); FWIW the same cast would work for the OP ((object)expando.someVar).Should().Be("string"); |
Hi,
Is there a way to make FluentAssertions work with dynamic/DLR? Consider the following code:
which throws
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException
: "'string' does not contain a definition for 'Should'"Thanks!
The text was updated successfully, but these errors were encountered: