public void ExcelAttributeCollection_Add_ExistingKey_ThrowsException()
        {
            // Arrange
            var thrown = false;
            var key    = "key";
            var value1 = "value1";
            var value2 = "value2";

            var list = new ExcelAttributeCollection();

            list.Add(key, value1);

            // Act
            try
            {
                list.Add(key, value2);
            }
            catch (ArgumentException) { thrown = true; }

            // Assert
            Assert.IsTrue(thrown);
        }
        public void ExcelAttributeCollection_Add()
        {
            // Arrange
            var key   = "key";
            var value = "value";

            var list = new ExcelAttributeCollection();

            // Act
            list.Add(key, value);

            // Assert
            Assert.AreEqual(1, list.Count);
        }
        public void ExcelAttributeCollection_Contains_ExistingKey_IgnoresCase()
        {
            // Arrange
            var key   = "key";
            var value = "value";

            var list = new ExcelAttributeCollection();

            list.Add(key, value);

            // Act
            var exists = list.Contains("KEY");

            // Assert
            Assert.IsTrue(exists);
        }
        public void ExcelAttributeCollection_ByKey_GetsValue()
        {
            // Arrange
            var key   = "key";
            var value = "value";

            var list = new ExcelAttributeCollection();

            list.Add(key, value);

            // Act
            var itemValue = list["key"];

            // Assert
            Assert.AreEqual(value, itemValue);
        }
        public void ExcelAttributeCollection_Contains_NotExistingKey()
        {
            // Arrange
            var key   = "key";
            var value = "value";

            var list = new ExcelAttributeCollection();

            list.Add(key, value);

            // Act
            var exists = list.Contains("wrongkey");

            // Assert
            Assert.IsFalse(exists);
        }
        public void ExcelAttributeCollection_Remove_ByKey_ReturnsFalseIfItemExists()
        {
            // Arrange
            var key   = "key";
            var value = "value";

            var list = new ExcelAttributeCollection();

            list.Add(key, value);

            // Act
            var removed = list.Remove("wrongkey");

            // Assert
            Assert.AreEqual(1, list.Count);
            Assert.IsFalse(removed);
        }
        public void ExcelAttributeCollection_ByKey_SetsValue_CreateIfNotExists()
        {
            // Arrange
            var key           = "key";
            var value         = "value";
            var modifiedValue = "new value";

            var list = new ExcelAttributeCollection();

            list.Add(key, value);

            // Act
            list[key] = modifiedValue;

            // Assert
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(modifiedValue, list[0].Value);
        }