Skip to content

Instantly share code, notes, and snippets.

@foyzulkarim
Last active August 29, 2015 14:02
Show Gist options
  • Save foyzulkarim/ffc3bb25c0352ae41f5e to your computer and use it in GitHub Desktop.
Save foyzulkarim/ffc3bb25c0352ae41f5e to your computer and use it in GitHub Desktop.
namespace XmlParserLibrary
{
public class MyXmlParser
{
public string GetValue(string node)
{
String s = "";
if (node.StartsWith("<xml>") && node.EndsWith("</xml>"))
{
s = node.Split(new[] {"<xml>"},StringSplitOptions.None)[1].Split(new []{"</xml>"},
StringSplitOptions.None)[0];
}
return s;
}
}
}
namespace XmlParserLibraryTestProject
{
[TestClass]
public class MyXmlParserTest
{
[TestMethod]
public void testGetValue()
{
MyXmlParser class1 = new MyXmlParser();
String value = class1.GetValue("<xml>test</xml>");
Assert.AreEqual("test",value,"Failed");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment