Inheritance: DomainObject
コード例 #1
0
        public void ProjectShouldBeConvertedToXml()
        {
            Project project = new Project
            {
                Archived = false,
                Budget = 1000,
                Customer = new Customer
                {
                    Name = "test"
                },
                Id = 2,
                Name = "Test project"
            };

            string xml = new ProjectConverter().Convert(project);

            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);

            string value = xmlDocument.SelectSingleNode("/project/name").InnerText;

            Assert.That(value, Is.EqualTo(project.Name.ToString(CultureInfo.InvariantCulture)));
        }
コード例 #2
0
        public void Money_Budget_Type_Should_Be_Written_To_Xml()
        {
            Project project = new Project();
           // project.Name = "test";
            project.BudgetType = BudgetType.cents;

            ProjectConverter projectConverter = new ProjectConverter();
            string xml = projectConverter.Convert(project);

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(xml);

            XmlNode value = xmlDocument.SelectSingleNode("/project/budget-type");

            Assert.That(value.InnerText, Is.EqualTo("cents"));
        }