created a custom code activity for calculation of any given expression from console.Its a workflow console application.It works fine but the unit test created for this activity has run time issue.I followed creating a unit test for any activity from pro WF4 book.It takes too long to run these tests and when i stop and see the run results:0/2 tests passed,0 failed, 2 skipped.how can i solve this?
I have created testproject in the same solution and trying to run the test.
ParseCalculationArgsTest is the class file,contains the below code
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Calculator;
using System.Activities;
namespace CalculatorTest
{
[TestClass]
public class ParseCalculatorArgsTest
{
[TestMethod]
public void ValidExpressionTest()
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("Expression", " 1 + 2 ");
IDictionary<string, object> outputs = WorkflowInvoker.Invoke(new ParseCalculatorArgs(), parameters);
Assert.IsNotNull(outputs, "Outputs should not be null");
Assert.AreEqual(3, outputs.Count, "Output count sould be there");
Assert.AreEqual((Double)1, outputs["FirstNumber"], "FirstNUmber should not be incorrect");
Assert.AreEqual((Double)2, outputs["SecondNumber"], "Second number shouldn't be incorrect");
Assert.AreEqual("+", outputs["Operation"], "Operation is inccorect");
}
[TestMethod]
public void InvalidExpressionTest()
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("Expression", " badexpression ");
IDictionary<string, object> outputs = WorkflowInvoker.Invoke(new ParseCalculatorArgs(), parameters);
Assert.IsNotNull(outputs, "Outputs should not be null");
Assert.AreEqual(3, outputs.Count, "Output count sould be there");
Assert.AreEqual("error", outputs["Operation"], "Operation is inccorect");
}
}
}
Any sugestion how to run these test successfully ,so that it will show the result as passed.