public BindingOperation Make(Tree <Cell> nameCell) { string name = nameCell.Value.Text.Trim(); if (NoOperationIsImpliedBy(name)) { return(new NoBinding()); } var cellOperation = new CellOperationImpl(processor); if (CheckIsImpliedBy(name)) { return(new CheckBinding(cellOperation, targetProvider, nameCell)); } string memberName = processor.ParseTree <Cell, MemberName>(nameCell).ToString(); RuntimeMember member = RuntimeType.FindInstance(targetProvider, new IdentifierName(memberName), 1); if (member == null && newIdentifier.IsStartOf(name)) { string newMemberName = name.Substring(4); return(new CreateBinding(processor, adapter, newMemberName)); } return(new InputBinding(processor, targetProvider, nameCell)); }
private void ProcessTestDocument(string document, StoryTestWriter writer) { try { var storyTest = new StoryTest(service, writer) .WithInput(document) .OnAbandonSuite(() => { suiteIsAbandoned = true; }); reporter.WriteLine(storyTest.Leader); if (suiteSetupIdentifier.IsStartOf(storyTest.Leader) || IMaybeProcessingSuiteSetup) { storyTest.Execute(); } else { storyTest.Execute(new Service.Service(service)); } } catch (Exception e) { var testStatus = new TestStatus(); var parse = new CellBase(parseError, "div"); parse.SetAttribute(CellAttribute.Body, parseError); testStatus.MarkException(parse, e); writer.WriteTable(new CellTree(parse)); writer.WriteTest(new CellTree().AddBranchValue(parse), testStatus.Counts); } }
private void ProcessTestDocument(string document, Action <string, TestCounts> writer) { try { Tree <Cell> result = service.Compose(new StoryTestString(document)); var parse = result != null ? (Parse)result.Value : null; var storyTest = new StoryTest(parse, (tables, counts) => WriteResults(tables, counts, writer)); reporter.WriteLine(parse.Leader); if (suiteSetupIdentifier.IsStartOf(parse.Leader) || IMaybeProcessingSuiteSetup) { storyTest.ExecuteOnConfiguration(service.Configuration); } else { storyTest.Execute(service.Configuration); } } catch (Exception e) { var testStatus = new TestStatus(); var parse = new CellBase(parseError, "div"); parse.SetAttribute(CellAttribute.Body, parseError); testStatus.MarkException(parse, e); WriteResults(new CellTree().AddBranchValue(parse), testStatus.Counts, writer); } }
public BindingOperation Make(Tree <Cell> nameCell) { var name = nameCell.Value.Text.Trim(); if (NoOperationIsImpliedBy(name)) { return(new NoBinding()); } if (CheckIsImpliedBy(name)) { return(new CheckBinding(processor, targetProvider, nameCell)); } var memberName = processor.ParseTree <Cell, MemberName>(nameCell); var member = MemberQuery.FindInstance(processor.FindMember, targetProvider, new MemberSpecification(memberName, 1)); if (member == null && newIdentifier.IsStartOf(name)) { string newMemberName = name.Substring(4); return(new CreateBinding(processor, adapter, newMemberName)); } return(new InputBinding(processor, targetProvider, nameCell)); }
public bool CanParse(Type type, TypedValue instance, Tree <Cell> parameters) { if (type != typeof(DateTime)) { return(false); } string text = parameters.Value.Content; if (!today.IsStartOf(text)) { return(false); } if (text.Length > today.Length) { string modifier = text.Substring(today.Length).Trim(); if (!modifier.StartsWith("+") && !modifier.StartsWith("-")) { return(false); } } return(true); }
public bool CanParse(Type type, TypedValue instance, Tree <Cell> parameters) { return(type == typeof(byte[]) && prefix.IsStartOf(parameters.Value.Text)); }
public override bool CanExecute(ExecuteContext context, ExecuteParameters parameters) { return(context.Command == ExecuteCommand.Check && exceptionIdentifier.IsStartOf(parameters.Cell.Text) && parameters.Cell.Text.EndsWith("]")); }
public bool CanCompare(TypedValue actual, Tree <Cell> expected) { return(expected.Value.Text != null && failIdentifier.IsStartOf(expected.Value.Text) && expected.Value.Text.EndsWith("]")); }