public void when_writing_the_grammar_structure() { SetVerificationGrammar grammar = Fixture.VerifySetOf(c => new ValidationError[0]) .Titled("the title") .LeafNameIs("group1") .MatchOn(x => x.Field, x => x.Message); var setVerification = grammar.ToStructure(null).ShouldBeOfType <SetVerification>(); var expected = new SetVerification("the title", "group1", Cell.For <string>("Field"), Cell.For <string>("Message")); setVerification.ShouldEqual(expected); }
public SetVerificationGrammar Grammar() { var grammar = new SetVerificationGrammar(_leafName, _title, _comparer) { Description = _description, Ordered = _ordered }; if (_dataSource != null) { grammar.Before((step, context) => { context.CurrentObject = _dataSource(context); }); } return(grammar); }
public SetVerificationGrammar Columns(Action <IDataRowComparer> action) { var comparer = new DataRowComparer(); action(comparer); var grammar = new SetVerificationGrammar(_leafName, _title, comparer) { Description = _description }; if (_dataSource != null) { grammar.Before((step, context) => { context.CurrentObject = _dataSource(context).Rows; }); } return(grammar); }
public SetVerificationGrammar MatchOn(params Expression <Func <T, object> >[] properties) { var comparer = new ObjectComparer <T>(); foreach (var property in properties) { comparer.MatchOn(property); } var grammar = new SetVerificationGrammar(_leafName, _title, comparer) { Description = _description, Ordered = _ordered }; grammar.Before((step, context) => { context.CurrentObject = _dataSource(context); }); return(grammar); }
IGrammar IGrammarSource.ToGrammar(MethodInfo method, Fixture fixture) { var databaseFixture = fixture.As <DatabaseFixture>(); SetVerificationGrammar grammar = null; var comparison = new RowFieldComparison(databaseFixture, _fields.ToArray(), toCommandBuilder(method)); grammar = new SetVerificationGrammar(_title, "rows", comparison); if (_ordered) { grammar.Ordered(); } if (method.GetParameters().Any()) { var line = new DbCommandGrammar(databaseFixture, method, _commandType, _sql); if (_fetchFormat.IsNotEmpty()) { line.Format(_fetchFormat); } line.Execution = new DbSetExecution(new BufferedReader(_fields)); var paragraph = new ParagraphGrammar(_title); paragraph.Children.Add(line); paragraph.Children.Add(grammar); return(paragraph); } return(grammar); }