Example #1
0
        public void DesignerActionItemCollection_Remove_Invoke_Success()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);
            Assert.Same(value, Assert.Single(collection));

            collection.Remove(value);
            Assert.Empty(collection);
            Assert.False(collection.Contains(value));
            Assert.Equal(-1, collection.IndexOf(value));
        }
        public override DesignerActionItemCollection GetSortedActionItems()
        {
            DesignerActionItemCollection items = base.GetSortedActionItems();
            DesignerActionPropertyItem   item  = items.OfType <DesignerActionPropertyItem>().FirstOrDefault(x => x.MemberName == "FormatString");

            if (item != null)
            {
                items.Remove(item);
            }
            items.Add(new DesignerActionPropertyItem("WidthF", "WidthF"));
            items.Add(new DesignerActionPropertyItem("HeightF", "HeightF"));
            items.Add(new DesignerActionPropertyItem("LocationX", "LocationX"));
            items.Add(new DesignerActionPropertyItem("LocationY", "LocationY"));
            return(items);
        }
Example #3
0
        public void DesignerActionItemCollection_Insert_Remove_Count()
        {
            DesignerActionItemCollection underTest = new DesignerActionItemCollection();
            DesignerActionItem           item1     = new DesignerActionItemTest("name", "category", "description");
            DesignerActionItem           item2     = new DesignerActionItemTest("name1", "category1", "description1");
            DesignerActionItem           item3     = new DesignerActionItemTest("name2", "category2", "description2");
            DesignerActionItem           item4     = new DesignerActionItemTest("name3", "category3", "description3");

            underTest.Add(item1);
            underTest.Add(item2);

            underTest.Add(item3);
            Assert.Equal(2, underTest.IndexOf(item3));

            underTest.Insert(2, item4);
            Assert.Equal(3, underTest.IndexOf(item3));
            Assert.Equal(2, underTest.IndexOf(item4));

            underTest.Remove(item4);
            Assert.False(underTest.Contains(item4));
            Assert.Equal(2, underTest.IndexOf(item3));
            Assert.Equal(3, underTest.Count);
        }
Example #4
0
        public void DesignerActionItemCollection_Remove_NullValue_ThrowsArgumentNullException()
        {
            var collection = new DesignerActionItemCollection();

            Assert.Throws <ArgumentNullException>("value", () => collection.Remove(null));
        }