Exemplo n.º 1
0
        public void DesignerActionItemCollection_Item_SetNull_ThrowsArgumentNullException()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);
            Assert.Throws <ArgumentNullException>("value", () => collection[0] = null);
        }
Exemplo n.º 2
0
        public void DesignerActionItemCollection_IndexOf_NoSuchValue_ReturnsNegativeOne()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);

            Assert.Equal(-1, collection.IndexOf(new SubDesignerActionItem("displayName", "category", "description")));
            Assert.Equal(-1, collection.IndexOf(null));
        }
Exemplo n.º 3
0
        public void DesignerActionItemCollection_Contains_NoSuchValue_ReturnsFalse()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);

            Assert.False(collection.Contains(new SubDesignerActionItem("displayName", "category", "description")));
            Assert.False(collection.Contains(null));
        }
Exemplo n.º 4
0
        public void DesignerActionItemCollection_CopyTo_Invoke_Success()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);

            var array = new DesignerActionItem[3];

            collection.CopyTo(array, 1);
            Assert.Equal(new DesignerActionItem[] { null, value, null }, array);
        }
        public void DesignerActionItem_ShowInSourceView_Set_GetReturnsExpected(bool value)
        {
            var item = new SubDesignerActionItem("displayName", "category", "description")
            {
                ShowInSourceView = value
            };

            Assert.Equal(value, item.ShowInSourceView);

            // Set same.
            item.ShowInSourceView = value;
            Assert.Equal(value, item.ShowInSourceView);
        }
        public void DesignerActionItem_AllowAssociate_Set_GetReturnsExpected(bool value)
        {
            var item = new SubDesignerActionItem("displayName", "category", "description")
            {
                AllowAssociate = value
            };

            Assert.Equal(value, item.AllowAssociate);

            // Set same.
            item.AllowAssociate = value;
            Assert.Equal(value, item.AllowAssociate);
        }
        public void DesignerActionItem_Ctor_String_String_String(string displayName, string category, string description, string expectedDisplayName)
        {
            var item = new SubDesignerActionItem(displayName, category, description);

            Assert.Equal(expectedDisplayName, item.DisplayName);
            Assert.Equal(category, item.Category);
            Assert.Equal(description, item.Description);
            Assert.False(item.AllowAssociate);
            Assert.Empty(item.Properties);
            Assert.Same(item.Properties, item.Properties);
            Assert.IsType <HybridDictionary>(item.Properties);
            Assert.True(item.ShowInSourceView);
        }
Exemplo n.º 8
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));
        }
Exemplo n.º 9
0
        public void DesignerActionItemCollection_Clear_Success()
        {
            var collection = new DesignerActionItemCollection();
            var value      = new SubDesignerActionItem("displayName", "category", "description");

            collection.Add(value);

            collection.Clear();
            Assert.Empty(collection);

            // Clear again.
            collection.Clear();
            Assert.Empty(collection);
        }
Exemplo n.º 10
0
        public void DesignerActionItemCollection_Item_Set_GetReturnsExpected()
        {
            var collection = new DesignerActionItemCollection();
            var value1     = new SubDesignerActionItem("displayName", "category", "description");
            var value2     = new SubDesignerActionItem("displayName", "category", "description");

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

            collection[0] = value2;
            Assert.Same(value2, Assert.Single(collection));
            Assert.Same(value2, collection[0]);
            Assert.False(collection.Contains(value1));
            Assert.Equal(-1, collection.IndexOf(value1));
            Assert.True(collection.Contains(value2));
            Assert.Equal(0, collection.IndexOf(value2));
        }
Exemplo n.º 11
0
        public void DesignerActionItemCollection_Insert_DesignerActionItem_Success()
        {
            var collection = new DesignerActionItemCollection();

            var value1 = new SubDesignerActionItem("displayName", "category", "description");

            collection.Insert(0, value1);
            Assert.Same(value1, Assert.Single(collection));
            Assert.Same(value1, collection[0]);
            Assert.True(collection.Contains(value1));
            Assert.Equal(0, collection.IndexOf(value1));

            var value2 = new SubDesignerActionItem("displayName", "category", "description");

            collection.Insert(0, value2);
            Assert.Equal(new object[] { value2, value1 }, collection.Cast <object>());
            Assert.True(collection.Contains(value2));
            Assert.Equal(0, collection.IndexOf(value2));
        }