public void TestAddAndRetrievePropertiesWithoutAttributes()
        {
            const string fileName = "no_attributes.xml";

            // Delete existing file.
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            // Create new properties.
            var properties = new PropertiesFile(fileName);

            var test1Property = new Property("test1", "test1Value");
            var test2Property = new Property("test2", "test2Value");

            // Write properties
            properties.AddProperty(test1Property);
            properties.AddProperty(test2Property);

            // Read properties
            var test1Properties = properties.GetPropertiesByKey(test1Property.Key).ToArray();
            var test2Properties = properties.GetPropertiesByKey(test2Property.Key).ToArray();

            // Check lengths
            Assert.AreEqual(1, test1Properties.Length);
            Assert.AreEqual(1, test2Properties.Length);

            // Check contents
            Assert.AreEqual(test1Property, test1Properties[0]);
            Assert.AreEqual(test2Property, test2Properties[0]);
        }
        public void TestAddAndRetrieveMultipleOfSameProperties()
        {
            const string fileName = "save_load_multiple.xml";

            // Delete existing file.
            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }

            // Create new properties.
            var properties = new PropertiesFile(fileName);

            var attributes1 = new Dictionary <string, string> {
                ["test1Attr"] = "test1AttrValue"
            };
            var attributes2 = new Dictionary <string, string> {
                ["test2Attr"] = "test2AttrValue"
            };

            var test1Property = new Property("test1", "test1Value", attributes1);
            var test2Property = new Property("test2", "test2Value", attributes2);
            var test3Property = new Property("test1", "test1Value2");

            // Write properties
            properties.AddProperty(test1Property);
            properties.AddProperty(test2Property);
            properties.AddProperty(test3Property);

            // Read properties
            var test1Properties = properties.GetPropertiesByKey(test1Property.Key).ToArray();
            var test2Properties = properties.GetPropertiesByKey(test2Property.Key).ToArray();

            // Check lengths
            Assert.AreEqual(2, test1Properties.Length);
            Assert.AreEqual(1, test2Properties.Length);

            // Check contents
            Assert.AreEqual(test1Property, test1Properties[0]);
            Assert.AreEqual(test2Property, test2Properties[0]);
            Assert.AreEqual(test3Property, test1Properties[1]);
        }