Exemplo n.º 1
0
        public void TestIndexerGet()
        {
            EventBoundListWrapper <StubClass> list;

            list = new EventBoundListWrapper <StubClass>(new List <StubClass>(OriginalList));
            Assert.AreSame(OriginalList[1], list[1]);
        }
Exemplo n.º 2
0
        public void TestCount()
        {
            EventBoundListWrapper <StubClass> list;

            list = new EventBoundListWrapper <StubClass>(new List <StubClass>(OriginalList));
            Assert.AreEqual(3, list.Count);
        }
Exemplo n.º 3
0
        public void TestIsReadOnly()
        {
            EventBoundListWrapper <StubClass> list;

            list = new EventBoundListWrapper <StubClass>(new List <StubClass>(OriginalList));
            Assert.IsFalse(list.IsReadOnly, "Not read only");

            list = new EventBoundListWrapper <StubClass>(OriginalList);
            Assert.IsTrue(list.IsReadOnly, "Read only");
        }
Exemplo n.º 4
0
        public void TestRemove()
        {
            EventBoundListWrapper <StubClass> list;

            list = new EventBoundListWrapper <StubClass>(new List <StubClass>(OriginalList));
            list.BeforeRemove = (coll, item) => { item.AProperty = "BeforeRemove"; return(true); };
            StubClass removed = list[2];

            list.Remove(removed);

            Assert.AreEqual(2, list.Count, "Count");
            Assert.AreEqual("BeforeRemove", removed.AProperty, "Property is set");
        }
Exemplo n.º 5
0
        public void TestAdd()
        {
            EventBoundListWrapper <StubClass> list;

            list           = new EventBoundListWrapper <StubClass>(new List <StubClass>(OriginalList));
            list.BeforeAdd = (coll, item) => { item.AProperty = "BeforeAdd"; return(true); };
            StubClass added = new StubClass();

            list.Add(added);

            Assert.AreEqual(4, list.Count, "Count");
            Assert.AreSame(added, list[3], "Same instance");
            Assert.AreEqual("BeforeAdd", added.AProperty, "Property is set");
        }