← 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

Akim Boyko posted a new comment:
Another way to cover this issue is working with dynamic as
IDictionary<string, Object> and using CollectionAssert.IsSubsetOf

example:
var client = new FacebookClient(accessToken);
dynamic userInfo = client.Get("me");
Assert.That(userInfo, Is.Not.Null);

var requiredDynamicProperties = new[] { "id", "name", "wtf" };

var dictionary = (userInfo as IDictionary<string, Object>);

CollectionAssert.IsSubsetOf(requiredDynamicProperties, dictionary.Keys); 
// message will describe in details that no "wtf" found

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