Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ade88c47d5
Fetching contributors…

Cannot retrieve contributors at this time

file 36 lines (31 sloc) 0.961 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
using System.Xml.Serialization;
using NUnit.Framework;
using SharpBrake.Mvc.Serialization;

namespace Tests
{
[XmlRoot("notice", Namespace = "")]
    public class TestNotice
    {
[XmlElement("api-key")]
        public string ApiKey { get; set; }

[XmlAttribute("version")]
        public string Version { get; set; }
    }

[TestFixture]
    public class CleanXmlGeneration
    {
[Test]
        public void Xml_contains_no_fluff()
        {
            var notice = new TestNotice
                             {
                                 ApiKey = "123456",
                                 Version = "2.0"
                             };

            var serializer = new CleanXmlSerializer<TestNotice>();
            string xml = serializer.ToXml(notice);

            const string expected = @"<notice version=""2.0""><api-key>123456</api-key></notice>";
            Assert.AreEqual(expected, xml);
        }
    }
}
Something went wrong with that request. Please try again.