Created
March 21, 2011 09:56
-
-
Save hanssens/879239 to your computer and use it in GitHub Desktop.
WF4.0 Sample (Invoke + Arguments in/out)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void HelloWorldTest() | |
{ | |
var writer = new StringWriter(); | |
Console.SetOut(writer); | |
var target = new HelloWorld(); | |
WorkflowInvoker.Invoke(target); | |
// [??] Waarom werkt dit verdomme nog niet?? | |
Assert.IsTrue(String.Compare(writer.GetStringBuilder().ToString(), "Hello world!") == 0); | |
} | |
[TestMethod] | |
public void ValidateCustomerTest() | |
{ | |
// Arrange - input parameter(s) | |
var customer = new Customer() | |
{ | |
CustomerId = 1, | |
DisplayName = "Lorem ipsum" | |
}; | |
try | |
{ | |
// Invoke workflow only works if you assing shizzle in a LambdaValue, i.e. | |
// arguments passed to an activity only work if they're wrapped/packed with/by a LambdaValue | |
var output = WorkflowInvoker.Invoke( | |
new ValidateCustomer() | |
{ | |
myCustomer = new LambdaValue<Customer>(thisIsUtterlyUseless => customer) | |
}); | |
Assert.AreEqual(customer.DisplayName , output.First().Value); | |
} | |
catch (Exception ex) | |
{ | |
Assert.Fail(ex.Message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment