public void CheckBasicTableFormatMustBeJson()
        {
            var       format    = FormatterFactory.CreateFormat("TABLE");
            string    retString = "{" + Environment.NewLine + "  \"Var1\": \"test\"," + Environment.NewLine + "  \"Var2\": \"test\"" + Environment.NewLine + "}";
            TestTable test      = new TestTable();

            Assert.AreEqual(retString, format.Format <TestTable>(test));
        }
        public void CheckICommandValueTableFormatSimpleReturnTheGoodSring()
        {
            var    format               = FormatterFactory.CreateFormat("TABLE");
            string retString            = "Var1 : test" + Environment.NewLine + "Var2 : test" + Environment.NewLine;
            TestTableCommandValues test = new TestTableCommandValues();

            Assert.AreEqual(retString, format.Format <TestTableCommandValues>(test));
        }
        public void CheckICommandValueTableDictionaryFormatReturnTheGoodSring()
        {
            var    format    = FormatterFactory.CreateFormat("TABLE");
            string retString = "Var1 : test" + Environment.NewLine + "Var2 : " + Environment.NewLine + "    key1 : value1" + Environment.NewLine + "    key2 : value2" + Environment.NewLine;
            TestTableCommandValuesDictionary test = new TestTableCommandValuesDictionary();

            Assert.AreEqual(retString, format.Format <TestTableCommandValuesDictionary>(test));
        }
Example #4
0
        public void CheckBasicJsonFormatReturnTheGoodSring()
        {
            var      format    = FormatterFactory.CreateFormat("JSON");
            string   retString = "{" + Environment.NewLine + "  \"Var1\": \"test\"," + Environment.NewLine + "  \"Var2\": \"test\"" + Environment.NewLine + "}";
            TestJson test      = new TestJson();

            Assert.AreEqual(retString, format.Format <TestJson>(test));
        }
Example #5
0
        public void CheckBasicXmlFormatReturnTheGoodSring()
        {
            var     format    = FormatterFactory.CreateFormat("XML");
            string  retString = "<Information>" + Environment.NewLine + "  <Var1>test</Var1>" + Environment.NewLine + "  <Var2>test</Var2>" + Environment.NewLine + "</Information>";
            TestXML test      = new TestXML();

            Assert.AreEqual(retString, format.Format <TestXML>(test));
        }
        public void CheckICommandValueTableFormatListReturnTheGoodSring()
        {
            var    format    = FormatterFactory.CreateFormat("TABLE");
            string retString = " --------------- " + Environment.NewLine + " | Var1 | Var2 |" + Environment.NewLine + " --------------- " + Environment.NewLine + " | test | test |" + Environment.NewLine + " --------------- " + Environment.NewLine + " | test | test |" + Environment.NewLine + " --------------- " + Environment.NewLine + Environment.NewLine + " Count: 2";
            List <TestTableCommandValues> test = new List <TestTableCommandValues>()
            {
                new TestTableCommandValues(), new TestTableCommandValues()
            };

            Assert.AreEqual(retString, format.FormatCollection <TestTableCommandValues>(test));
        }
Example #7
0
        public void CheckBasicJsonFormatListReturnTheGoodSring()
        {
            var             format    = FormatterFactory.CreateFormat("TABLE");
            string          retString = "[" + Environment.NewLine + "  {" + Environment.NewLine + "    \"Var1\": \"test\"," + Environment.NewLine + "    \"Var2\": \"test\"" + Environment.NewLine + "  }" + Environment.NewLine + "]";
            List <TestJson> test      = new List <TestJson>()
            {
                new TestJson()
            };

            Assert.AreEqual(retString, format.FormatCollection <TestJson>(test));
        }
        public void CreateFormatForPhpThrowError()
        {
            var ex = Assert.Throws <MissingMethodException>(() => FormatterFactory.CreateFormat("PHP"));

            Assert.IsNotNull(ex);
        }
 public void CreateFormatForXmlReturnFormatXml()
 {
     Assert.IsTrue(FormatterFactory.CreateFormat("XML") is FormatterFactory.XMLFormatter);
 }
 public void CreateFormatForJsonReturnFormatJson()
 {
     Assert.IsTrue(FormatterFactory.CreateFormat("JSON") is FormatterFactory.JsonFormatter);
 }
 public void CreateFormatForTableReturnFormatTable()
 {
     Assert.IsTrue(FormatterFactory.CreateFormat("TABLE") is FormatterFactory.TableFormatter);
 }