Hi I have a simple method as following and need to know how I can call it in Unit Test in Visual Studio
public static bool Test(string value, string regex)
{
if (Regex.IsMatch(value, regex, RegexOptions.IgnoreCase))
return true;
return false;
}
here is what I have sofar
[TestMethod]
public void TestMethod_Test()
{
string value = "myValue";
string regex = "&#@<>\s\\\$\(\)";
PrivateType pt = new PrivateType(typeof(myClass));
bool actualresult = (bool)pt.InvokeStatic("Test", new object[] { value, regex });
bool expectedResult = false;
Assert.AreEqual(actualresult, expectedResult);
}
Aucun commentaire:
Enregistrer un commentaire