public void TestContainsKeyValuePairThatDoesNotExists() { var d = new DynamicDictionary(); d.Add("foo", "bar"); Assert.IsFalse(d.Contains(new KeyValuePair <string, object>("key", "value"))); }
public void Should_return_false_when_contains_does_not_find_match() { // Given var input = new DynamicDictionary(); input["test1"] = 10; // When var result = input.Contains(new KeyValuePair <string, dynamic>("test1", 11)); // Then result.ShouldBeFalse(); }
/// <summary> /// Fills the specified instance type with the contents of the dynamic dictionary /// </summary> /// <typeparam name="T"></typeparam> /// <param name="p"></param> /// <returns></returns> public static T Fill <T>(this DynamicDictionary p, T instance) where T : class { Type t = typeof(T); t.GetProperties().ToList().ForEach(pi => { if (p.Contains(pi.Name)) { pi.SetValue(instance, p[pi.Name], new object[] { }); } }); return(instance); }
public void Should_return_true_when_contains_does_find_match() { // Given var input = new DynamicDictionary(); input["test1"] = 10; // When var result = input.Contains(new KeyValuePair<string, dynamic>("test1", 10)); // Then result.ShouldBeTrue(); }
public void TestContainsKeyValuePairThatDoesNotExists() { var d = new DynamicDictionary(); d.Add("foo", "bar"); Assert.IsFalse(d.Contains(new KeyValuePair<string, object>("key", "value"))); }