示例#1
0
        public void GetEnumerator_WithChildren_EnumeratorMatchesChildren()
        {
            CanvasContainer container = new CanvasContainer();
            CanvasObject    co        = new ButtonObject();

            container.Add(co);

            Assert.AreEqual(1, container.Count());
        }
示例#2
0
        public void Draw_WithChildren_DrawForwarded()
        {
            CanvasContainer container = new CanvasContainer();
            DummyObject     co        = new DummyObject();

            container.Add(co);

            container.Draw(null, null);

            Assert.AreEqual(1, co.drawCount);
        }
示例#3
0
        public void Add_Child_ChildAddedCollectionChangedTriggered()
        {
            int             collectionChangedCount = 0;
            CanvasContainer container = new CanvasContainer();

            container.CollectionChanged += (sender, e) => collectionChangedCount++;
            CanvasObject co = new ButtonObject();

            container.Add(co);

            Assert.AreEqual(1, collectionChangedCount);
            Assert.AreEqual(1, container.Count);
        }
示例#4
0
        public void Clear_Existing_AllChildRemoved()
        {
            int             collectionChangedCount = 0;
            CanvasContainer container = new CanvasContainer();
            CanvasObject    co        = new ButtonObject();

            container.Add(co);
            container.CollectionChanged += (sender, e) => collectionChangedCount++;

            container.Clear();

            Assert.AreEqual(1, collectionChangedCount);
            Assert.AreEqual(0, container.Count);
        }
示例#5
0
        public void Add_ChildRedraw_RedrawForwarded()
        {
            int             redrawCount = 0;
            CanvasContainer container   = new CanvasContainer();

            container.RedrawEvent += (c, area) => redrawCount++;
            CanvasObject co = new ButtonObject();

            container.Add(co);

            co.ReDraw();

            Assert.AreEqual(1, redrawCount);
        }