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."); }
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); }
public void TestRefreshConfiguration() { MessageParserManager.GetParser("XmlMessageParser"); MessageParserManager.RefreshConfiguration("XmlMessageParser"); }
public void TestGetParser2() { IMessageParser mp = MessageParserManager.GetParser("CsvMessageParser"); Assert.IsTrue(mp is XmlMessageParser, "Parser returned has wrong type."); }
public void TestGetParserFail2() { MessageParserManager.GetParser(null); }
public void TestGetParserFail1() { MessageParserManager.GetParser("NoSuchParser"); }
public void TestRefreshConfigurationFail2() { MessageParserManager.RefreshConfiguration(" "); }
public void TestRefreshConfigurationFail1() { MessageParserManager.RefreshConfiguration(null); }
public void TestGetParserFail3() { MessageParserManager.GetParser(" "); }