← Back to team overview

nunit-core team mailing list archive

Re: [Question #170909]: fluent syntax for C# dynamic

 

Question #170909 on NUnit Framework changed:
https://answers.launchpad.net/nunit-3.0/+question/170909

Description changed to:
I have an nUnit test case that asserts the dynamic that was returned
from Facebook C# SDK. Is there any way how to assert it using NUnit
fluent syntax. Here is very *simplified* example for what I'm looking
for:

// not working
var client = new FacebookClient(accessToken);
dynamic userInfo = client.Get("me");
Assert.That(userInfo, Is.Not.Null);
Assert.That(userInfo, Has.Property("id").Not.Null);
Assert.That(userInfo, Has.Property("name").Not.Null);

Right now I can only test by specifying 'properties' directly

// working, but not fluent
var client = new FacebookClient(accessToken);
dynamic userInfo = client.Get("me");
Assert.That(userInfo, Is.Not.Null);
Assert.That(userInfo.id, Is.Not.Null);
Assert.That(userInfo.name, Is.Not.Null);

Thanks for your answers.

-- 
You received this question notification because you are a member of
NUnit Core Developers, which is an answer contact for NUnit Framework.