public void ContainsTest() { var dic = new ObservableDictionary <int, string>(); dic.Contains(new KeyValuePair <int, string>(1, null)).Should().BeFalse(); dic.Add(1, "1"); dic.Add(2, "2"); dic.Contains(new KeyValuePair <int, string>(1, "1")).Should().BeTrue(); }
public void ContainsObjectInvalidTypeFalse() { var observableDictionary = new ObservableDictionary <int, int>() { { 1, 2 } }; var result = observableDictionary.Contains((object)"1"); Assert.IsFalse(result); }
public void ContainsObjectTrue() { var observableDictionary = new ObservableDictionary <int, int>() { { 1, 2 } }; var result = observableDictionary.Contains((object)1); Assert.IsTrue(result); }
public void ContainsKvpSuccess() { var observableDictionary = new ObservableDictionary <int, int>() { { 1, 2 } }; var result = observableDictionary.Contains(new KeyValuePair <int, int>(1, 2)); Assert.IsTrue(result); }
public void ObservableDictionaryContainsTest() { ObservableDictionary<GenericParameterHelper, GenericParameterHelper> target = new ObservableDictionary<GenericParameterHelper, GenericParameterHelper>(); KeyValuePair<GenericParameterHelper, GenericParameterHelper> itemAdded = new KeyValuePair<GenericParameterHelper, GenericParameterHelper>(new GenericParameterHelper(1), new GenericParameterHelper(1)); KeyValuePair<GenericParameterHelper, GenericParameterHelper> itemNotAdded = new KeyValuePair<GenericParameterHelper, GenericParameterHelper>(new GenericParameterHelper(2), new GenericParameterHelper(2)); target.Add(itemAdded); bool expectedAdded = true; bool expectedNotAdded = false; bool actualAdded = target.Contains(itemAdded); bool actualNotAdded = target.Contains(itemNotAdded); Assert.AreEqual(expectedAdded, actualAdded); Assert.AreEqual(expectedNotAdded, actualNotAdded); }