Improving the test application

Of course the sample above is reduced to the minimum. Therefore, let us blow up the sample to demonstrate the possibilities. Let’s split the solution into a user interface and logic piece. The following diagram shows the resulting flow definitions:

Flow2.png

Now we get three flows. The top level flow is still the “MainFlow”, but below this level, we have the Gui and the LogicFlow. Translated to the flow definition language we get:
FlowDefinition: MainFlow{
	Flow: Gui
	Flow: LogicFlow
	Wire: Gui.Value -> LogicFlow.Value
	Wire: LogicFlow.Result -> Gui.Result
	Wire: LogicFlow.ExceptionPin -> Gui.ExceptionPin
}

FlowDefinition: Gui {
	Step: Transform0Tests
	In: Result
	In: ExceptionPin
	Out: Value
	Wire: In.Result -> Transform0Tests.Result
	Wire: In.ExceptionPin -> Transform0Tests.ExceptionPin
	Wire: Transform0ab2Tests.Value -> Out.Value	
}

FlowDefinition: LogicFlow {
	Step: ToUpper
	Step: ToReverse
	In: Value
	Out: Result
	Out: ExceptionPin
	
	Wire: In.Value -> ToUpper.Value
	Wire: ToUpper.Uppered -> ToReverse.Value
	Wire: ToReverse.Reversed -> Out.Result

	Wire: ToUpper.ExceptionPin -> Out.ExceptionPin
	Wire: ToReverse.ExceptionPin -> Out.ExceptionPin
}

To test we use the „TestFlowDefinition1_Method2“:
[TestMethod]
public void TestFlowDefinition1_Method2() {
	AppBuilder tAppBuilder = new AppBuilder();
	tAppBuilder.LoadFlowsFromFile(@"{Your path!}\FD.Transform1.ab3");
	tAppBuilder.AddPreparedStepInstance("MainFlow.Gui""Transform0Tests"this);
	tAppBuilder.BuildApp(nullnull);
 
	this.Value("This is my test string!");
 	Assert.AreEqual(@"!GNIRTS TSET YM SI SIHT"this._Result);
}

The only difference to the test method above is that we inject the test class to a different flow namesapce („MainFlow.Gui“). Therefore, this sample demonstrates the namespace generation of the AppBuilder. The top level namespace is “MainFlow”. It’s just like common programming language works.

Last edited Apr 19, 2013 at 4:33 PM by InneHo, version 2

Comments

No comments yet.