public void ExtractData_HasName() { var reader = new StateReader(); var states = reader.ExtractData(FileText); states.ShouldNotContain(s => string.IsNullOrEmpty(s.Name)); }
public void ExtractData_ValidAcceptedAssignToExpression() { var reader = new StateReader(); var accepted = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Accepted")); accepted.AssignToExpression.ShouldBe("return null;"); }
public void ExtractData_ValidInitialAssignToExpression() { var reader = new StateReader(); var initial = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")); initial.AssignToExpression.ShouldBe("return null;"); }
public void ExtractData_ValidInitialHasBehaviours() { var reader = new StateReader(); var initial = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")); initial.Behaviours.Count.ShouldBe(2); }
public void ExtractData_InitialHasDraftTransition() { var reader = new StateReader(); var initial = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")); initial.Transitions.ShouldContain(t => t.Name.Equals("Draft")); }
public void ExtractData_RejectedEmptyTransitions() { var reader = new StateReader(); var rejected = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Rejected")); rejected.Transitions.ShouldBeEmpty(); }
public void ExtractData_Successfully() { var reader = new StateReader(); var states = reader.ExtractData(FileText); states.ShouldNotBeNull(); states.Count.ShouldBe(3); }
public void ExtractData_ValidDraftExpression() { var reader = new StateReader(); var draft = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")) .Transitions.Single(t => t.Name.Equals("Draft")); draft.Expression.ShouldBe("return true;"); }
public void ExtractData_ValidConfirmExpression() { var reader = new StateReader(); var confirm = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")) .Transitions.Single(t => t.Name.Equals("Confirm")); confirm.Expression.ShouldBe("var test = \"tst\";\r\n\t\t\tthis._name = \"Confirmation\";\r\n\t\t\treturn true;"); }
public void ExtractData_ValidInitialBehaviourOut() { var reader = new StateReader(); var initial = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")); initial.Behaviours.ShouldContain(b => b.Name.Equals("OnInitialOut") && b.Type.Equals("Out")); initial.Behaviours.Single(b => b.Name.Equals("OnInitialOut")).Expression.ShouldBe("this._name = \"Initial Out Name\";"); }
public void ExtractData_InitialHasTransitions() { var reader = new StateReader(); var initial = reader.ExtractData(FileText) .Single(m => m.Name.Equals("Initial")); initial.Transitions.ShouldNotBeEmpty(); initial.Transitions.Count.ShouldBe(3); }