I'm trying to write a test for the code below and tried a lot of options, but cannot get it right. I've now managed to write something without errors, but ofcourse this doesn't test my method. Some of my method:
protected virtual Expression Visit(Expression exp)
{
if (exp == null)
{
return exp;
}
switch (exp.NodeType)
{"Some case expressions")
default:
throw new Exception(string.Format("Unhandled expression type: '{0}'", exp.NodeType));
And this is my testcase so far, and ofcourse this fails..
[TestClass]
public class ExpressionVisitorTests : ExpressionVisitor
{
// public Statements.Solvers.ExpressionVisitor _instance;
public new Expression Visit(Expression exp)
{
return base.Visit(exp);
}
//Expression expectedException = null;
private string expected = "Hello World";
private string[] _expected = new string[] { "Hello World" };
private TestContext testContextInstance;
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
[TestInitialize]
public void Initialize()
{
// var _formatText = new Statements.Solvers.ExpressionVisitor.Expression();
}
[TestMethod]
public void CreateShouldThrowIfModelTestIsNull()
{
Assert.AreEqual("Hello World.", expected);
}
}
Can someone send me in the right direction please.
Aucun commentaire:
Enregistrer un commentaire