public void SerializableDictionaryTest_Invalid_Encoding()
        {
            //arrange

            var target = new Dictionary<string, string>()
                             {
                                 { "Name", "☃ ☁ ☠" },
                                 { "Email", "☢ ☥ ☺" }
                             };

            DictionaryExtensions.DefaultFileEncoding = Encoding.ASCII;

            //act
            var file = new FileInfo(Path.Combine(Environment.CurrentDirectory, "SerializedDictionary.txt"));
            target.SaveToDisk(file);

            //assert
            file.Refresh();
            Assert.IsTrue(file.Exists);
            var result = new Dictionary<string, string>();
            result.ReadFromDisk(file);

            //reset it
            DictionaryExtensions.DefaultFileEncoding = Encoding.UTF8;

            //with the wrong encoding this will fail!
            Assert.AreNotEqual(target["Name"], result["Name"]);
            Assert.AreNotEqual(target["Email"], result["Email"]);
        }
        public void SerializableDictionaryTest_Save_To_Disk_Read_From_Disk()
        {
            //arrange

            var target = new Dictionary<string, string>
                             {
                                 { "Name", "Shannon Deminick" },
                                 { "Email", "[email protected]" }
                             };

            //act
            var file = new FileInfo(Path.Combine(Environment.CurrentDirectory, "SerializedDictionary.txt"));
            target.SaveToDisk(file);

            //assert
            file.Refresh();
            Assert.IsTrue(file.Exists);
            var result = new Dictionary<string, string>();
            result.ReadFromDisk(file);
            Assert.AreEqual(target["Name"], result["Name"]);
            Assert.AreEqual(target["Email"], result["Email"]);
        }