Ejemplo n.º 1
0
        public void WriteDictionaryWithCustomContractTest()
        {
            var converter = new XmlDictionaryConverter();

            var value = new Dictionary <int, string>
            {
                { 1, "one" },
                { 2, "two" }
            };

            var expected = "<xml><item><key>1</key><value>one</value></item><item><key>2</key><value>two</value></item></xml>";
            var actual   = converter.ToXml(value.GetType(), value, contract: GetCustomContract());

            Assert.That(actual, IsXml.Equals(expected));
        }