コード例 #1
0
        public void ModelTrackerCollection_ExistingCollection_AddRemoveModel_RemoveReturnsTrue()
        {
            var m = new TestModel();

            Existing.Add(m);
            Assert.IsTrue(Existing.Remove(m));
        }
コード例 #2
0
        public void ModelTrackerCollection_ExistingCollection_AddRemoveModel_ContainsModel_ReturnsFalse()
        {
            var m = new TestModel();

            Existing.Add(m);
            Existing.Remove(m);
            Assert.IsFalse(Existing.Contains(m));
        }
コード例 #3
0
        public void ModelTrackerCollection_ExistingCollection_AddRmoveModel_CountUnchanged()
        {
            var m = new TestModel();
            var c = Existing.Count;

            Existing.Add(m);
            Existing.Remove(m);
            Assert.AreEqual(Existing.Count, c);
        }
コード例 #4
0
        public void ModelTrackerCollection_ExistingCollection_RemoveModel_EventInvoked()
        {
            var  m       = Existing.Skip(1).First();
            bool removed = false;

            Existing.ModelRemovedEvent += (s, e) => {
                Assert.AreEqual(m.Data, e.Model.Data);
                Assert.AreEqual(m.Id, e.Model.Id);
                removed = true;
            };

            Existing.Remove(m.Id);
            Assert.IsTrue(removed);
        }