示例#1
0
        public void Collections_HashSetOfNamedMutable_add_one_model_instance_just_once_test()
        {
            HashSetOfNamedMutable <Model> hs = new HashSetOfNamedMutable <Model>();

            Assert.AreEqual(0, hs.Count);

            Model model = new Model("Jack", 35);

            hs.Add(model);

            Assert.AreEqual(1, hs.Count);

            hs.Add(model);

            Assert.AreEqual(1, hs.Count);
        }
示例#2
0
        public void Collections_HashSetOfNamedMutable_add_updates_existing_model_fields_test()
        {
            HashSetOfNamedMutable <Model> hs = new HashSetOfNamedMutable <Model>();

            Assert.AreEqual(0, hs.Count);

            Model model = new Model("Jack", 35);

            hs.Add(model);
            Assert.AreEqual(1, hs.Count);

            Model update = new Model("Jack", 88);

            hs.Add(update);
            Assert.AreEqual(1, hs.Count);
            Assert.AreEqual(88, model.Value);
        }