예제 #1
0
        public void TestRefreshConfiguration()
        {
            IMessageParser parser1 = MessageParserManager.GetParser("XmlMessageParser");

            MessageParserManager.RefreshConfiguration("XmlMessageParser");
            IMessageParser parser2 = MessageParserManager.GetParser("XmlMessageParser");

            Assert.IsFalse(object.ReferenceEquals(parser1, parser2), "Incorrect RefreshConfiguration implementation.");
        }
예제 #2
0
        public void Demonstration()
        {
            //The amount of code involved in using this component is minimal.
            //More effort is required to set up the configurations correctly.
            //Refer to CS or sample config files in test_files folder for the same

            //Usage:

            //Use static method of MessageParserManager to get a parser instance.
            //Get default instance of parser
            IMessageParser parser = MessageParserManager.GetParser();

            //Or get a custom parser instance as per defined in configuration file, using the overloaded function.
            parser = MessageParserManager.GetParser("XmlMessageParser");

            //Get the message string to parse
            string messageText = File.ReadAllText("../../test_files/testMessage.xml");

            //Get the Message instance
            Message message = parser.ParseMessage(messageText);
        }
예제 #3
0
 public void TestRefreshConfiguration()
 {
     MessageParserManager.GetParser("XmlMessageParser");
     MessageParserManager.RefreshConfiguration("XmlMessageParser");
 }
예제 #4
0
        public void TestGetParser2()
        {
            IMessageParser mp = MessageParserManager.GetParser("CsvMessageParser");

            Assert.IsTrue(mp is XmlMessageParser, "Parser returned has wrong type.");
        }
예제 #5
0
 public void TestGetParserFail2()
 {
     MessageParserManager.GetParser(null);
 }
예제 #6
0
 public void TestGetParserFail1()
 {
     MessageParserManager.GetParser("NoSuchParser");
 }
예제 #7
0
 public void TestRefreshConfigurationFail2()
 {
     MessageParserManager.RefreshConfiguration("  ");
 }
예제 #8
0
 public void TestRefreshConfigurationFail1()
 {
     MessageParserManager.RefreshConfiguration(null);
 }
예제 #9
0
 public void TestGetParserFail3()
 {
     MessageParserManager.GetParser("  ");
 }