← Back to team overview

nunit-core team mailing list archive

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

 

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

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
dynamic userInfo = Facebook.GetUserInfo(accessToken);
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
dynamic userInfo = Facebook.GetUserInfo(accessToken);
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.