示例#1
0
        public virtual void TestFormatValueIndent()
        {
            AbstractAttributePropertyFormatterTest.TestableAttributePropertyFormatter formatter = new AbstractAttributePropertyFormatterTest.TestableAttributePropertyFormatter
                                                                                                      (this);
            string result = formatter.Format(GetContext("name"), new STImpl(), 0);

            Assert.AreEqual(AddLineSeparator("<name nullFlavor=\"NI\"/>"), result, "named null format");
            result = formatter.Format(GetContext("name"), new STImpl(), 1);
            Assert.AreEqual(AddLineSeparator("  <name nullFlavor=\"NI\"/>"), result, "named null format");
            result = formatter.Format(GetContext("name"), new STImpl(), 2);
            Assert.AreEqual(AddLineSeparator("    <name nullFlavor=\"NI\"/>"), result, "named null format");
        }
示例#2
0
        public virtual void TestFormatValueNonNull()
        {
            // no name-value pairs
            AbstractAttributePropertyFormatterTest.TestableAttributePropertyFormatter formatter = new AbstractAttributePropertyFormatterTest.TestableAttributePropertyFormatter
                                                                                                      (this);
            string result = formatter.Format(GetContext("name"), new STImpl("something"));

            Assert.AreEqual(AddLineSeparator("<name/>"), result, "named null format");
            // one name-value pair
            formatter.AddNameValuePair("name1", "value1");
            result = formatter.Format(GetContext("name"), new STImpl("something"));
            Assert.AreEqual(AddLineSeparator("<name name1=\"value1\"/>"), result, "named null format");
            // two name-value pairs
            formatter.AddNameValuePair("name2", "value2");
            result = formatter.Format(GetContext("name"), new STImpl("something"));
            Assert.AreEqual(AddLineSeparator("<name name1=\"value1\" name2=\"value2\"/>"), result, "named null format");
        }