Exemplo n.º 1
0
        public void GetAndSetValue()
        {
            PropertyBag bag = new PropertyBag();

            Assert.IsNull(bag.GetValue("key"));

            bag.SetValue("key", "value");
            Assert.AreEqual("value", bag.GetValue("key"));

            bag.SetValue("key", "different value");
            Assert.AreEqual("different value", bag.GetValue("key"));

            bag.SetValue("key", null);
            Assert.IsNull(bag.GetValue("key"));

            bag.Add("key", "value1");
            bag.Add("key", "value2");
            Assert.AreEqual("value1", bag.GetValue("key"));
            Assert.AreElementsEqual(new[] { "value1", "value2" }, bag["key"]);

            bag.SetValue("key", "value");
            Assert.AreElementsEqual(new[] { "value" }, bag["key"]);
        }
 /// <summary>Assert.AreElementsEqual</summary>
 public static void Is <T>(this IEnumerable <T> actual, IEnumerable <T> expected, EqualityComparison <T> comparison, string message = "")
 {
     Assert.AreElementsEqual(expected, actual, comparison, message);
 }
 /// <summary>Assert.AreElementsEqual</summary>
 public static void Is <T>(this IEnumerable <T> actual, IEnumerable <T> expected, string message = "")
 {
     Assert.AreElementsEqual(expected, actual);
 }