public void TestSaveLoad()
        {
            var dictionary1 = new XmlDictionary
            {
                { "key1", "value1" },
                { "key2", "value2" }
            };

            // Serialize and deserialize data
            string data        = dictionary1.ToXmlString();
            var    dictionary2 = XmlStorage.FromXmlString <XmlDictionary>(data);

            // Ensure data stayed the same
            dictionary2.Should().Equal(dictionary1, because: "Serialized objects should be equal.");
            ReferenceEquals(dictionary1, dictionary2).Should().BeFalse(because: "Serialized objects should not return the same reference.");
        }
        public void ShouldRejectDuplicateKeys()
        {
            var dictionary = new XmlDictionary
            {
                { "key1", "value1" },
                { "key2", "value2" }
            };

            // Check for duplicate keys when adding new entries
            dictionary.Invoking(x => x.Add("key1", "newValue1")).ShouldThrow <ArgumentException>();

            // Check for duplicate keys when modifying existing entries
            var entry = new XmlDictionaryEntry("key3", "value3");

            dictionary.Add(entry);
            entry.Invoking(x => x.Key = "key1").ShouldThrow <InvalidOperationException>();
        }