Example #1
0
 public void ReadExpected(ITestContext context, IStep step, SetRow row)
 {
     Cell.ReadArgument(context, step, x =>
     {
         row.Values[Cell.Key] = x;
     });
 }
Example #2
0
 public void ReadExpected(ITestContext context, IStep step, SetRow row)
 {
     Cell.ReadArgument(context, step, x =>
     {
         row.Values[Cell.Key] = x;
     });
 }
Example #3
0
 void ISetColumn.ReadExpected(ITestContext context, IStep step, SetRow row)
 {
     _cell.ReadArgument(context, step, x =>
     {
         row.Values[_columnName] = x;
     });
 }
Example #4
0
        void ISetColumn.ReadActual(object target, SetRow row)
        {
            var dataRow = target.As <DataRow>();

            assertColumnExists(dataRow);

            row.Values[_columnName] = dataRow[_columnName] == DBNull.Value ? null : dataRow[_columnName];
        }
        private SetRow toActual(object target)
        {
            var row = new SetRow();

            _comparer.Columns.Each(x => x.ReadActual(target, row));

            return(row);
        }
        public void read_correctly_formatted_step_value()
        {
            Step step = new Step().With("DistanceFromOffice:112.5");
            var row = new SetRow();

            match.ReadExpected(new TestContext(), step, row);

            row.Values["DistanceFromOffice"].ShouldEqual(112.5);
        }
        public void read_the_actual_values()
        {
            var row = new SetRow();

            _matchCity.ReadActual(table.Rows[0], row);
            _matchDistance.ReadActual(table.Rows[0], row);

            row.Values["City"].ShouldEqual("Austin");
            row.Values["Distance"].ShouldEqual(16);
        }
        private SetRow buildRow(string text)
        {
            var row = new SetRow();
            text.Trim().Split(';').Each(x =>
            {
                var parts = x.Split('=');
                row.Values[parts[0]] = int.Parse(parts[1]);
            });

            return row;
        }
Example #9
0
        public bool Matches(ITestContext context, SetRow other)
        {
            if (MissingValues) return false;

            foreach (var key in Values.Keys)
            {
                if (!other.Values.Has(key)) return false;
                if (!context.Matches(Values[key], other.Values[key])) return false;
            }

            return true;
        }
        public void read_step_successfully_if_it_exists_and_is_formatted_correctly()
        {
            Step step = new Step().With("City:Dallas,Distance:189");
            var row = new SetRow();

            var context = new TestContext();

            _matchCity.ReadExpected(context, step, row);
            _matchDistance.ReadExpected(context, step, row);

            row.Values["City"].ShouldEqual("Dallas");
            row.Values["Distance"].ShouldEqual(189);
        }
        public void reads_actual_off_the_target_object()
        {
            var target = new Address
            {
                DistanceFromOffice = 23
            };

            var row = new SetRow();

            match.ReadActual(target, row);

            row.Values["DistanceFromOffice"].ShouldEqual(23);
        }
        private SetRow toExpectedRow(IStep step, ITestContext context)
        {
            var row = new SetRow()
            {
                Step = step
            };

            _comparer.Columns.Each(x =>
            {
                x.ReadExpected(context, step, row);
                if (!row.Values.Has(x.Cell.Key))
                {
                    row.MissingValues = true;
                }
            });

            return(row);
        }
Example #13
0
        public bool Matches(RowValueMatcher matcher, SetRow other)
        {
            if (MissingValues)
            {
                return(false);
            }

            foreach (var key in Values.Keys)
            {
                if (!other.Values.Has(key))
                {
                    return(false);
                }
                if (!matcher.Matches(key, Values[key], other.Values[key]))
                {
                    return(false);
                }
            }

            return(true);
        }
        public void when_creating_the_expected_row()
        {
            var step = new Step("something");
            step.Set(StringSetComparer.EXPECTED, "some text");

            var row = new SetRow();

            comparer.ReadExpected(new TestContext(), step, row);

            row.Values[StringSetComparer.EXPECTED].ShouldEqual("some text");
        }
        public void when_creating_the_actual_row()
        {
            var row = new SetRow();

            comparer.ReadActual("some text", row);

            row.Values[StringSetComparer.EXPECTED].ShouldEqual("some text");
        }
Example #16
0
 public void SetUp()
 {
     context = new TestContext();
     row1 = new SetRow();
     row2 = new SetRow();
 }
Example #17
0
 public void ReadActual(object target, SetRow row)
 {
     row.Values[_accessor.InnerProperty.Name] = _accessor.GetValue(target);
 }
Example #18
0
 public void ReadActual(object target, SetRow row)
 {
     row.Values[EXPECTED] = target;
 }
        private void writeVerificationResultRow(SetRow setRow, ITestContext context, bool ordered)
        {
            AddBodyRow(row =>
            {
                if (ordered)
                {
                    row.Cell(setRow.ActualOrder == 0 ? string.Empty : setRow.ActualOrder.ToString());
                }

                _table.Cells.Each(cell =>
                {
                    var display = context.GetDisplay(setRow.Values[cell.Key]);
                    row.Cell(display);
                });

                switch (setRow.Result)
                {
                    case SetMatch.Match:
                        row.AddClass(HtmlClasses.PASS);

                        break;

                    case SetMatch.Extra:
                        row.AddClass(HtmlClasses.FAIL);
                        var firstChild = row.FirstChild();
                        firstChild.Text("Extra:  " + firstChild.Text());
                        break;

                    case SetMatch.Missing:
                        row.AddClass(HtmlClasses.FAIL);
                        var tag = row.FirstChild();
                        tag.Text("Missing:  " + tag.Text());
                        break;

                    case SetMatch.OutOfOrder:
                        row.AddClass(HtmlClasses.FAIL);

                        string text = "Expected {0} but was {1}".ToFormat(setRow.ExpectedOrder, setRow.ActualOrder);
                        row.FirstChild().Text(text);
                        break;
                }

                row.FirstChild().AddClass("left-cell");
            });

            if (setRow.Step != null)
            {
                context.ResultsFor(setRow.Step).ForExceptionText(writeExceptionText);
            }
        }
Example #20
0
 public void ReadExpected(ITestContext context, IStep step, SetRow row)
 {
     Cell.ReadArgument(context, step, x => row.Values[EXPECTED] = x);
 }
        private SetRow toActual(object target)
        {
            var row = new SetRow();

            _comparer.Columns.Each(x => x.ReadActual(target, row));

            return row;
        }
        private SetRow toExpectedRow(IStep step, ITestContext context)
        {
            var row = new SetRow()
            {
                Step = step
            };

            _comparer.Columns.Each(x =>
            {
                x.ReadExpected(context, step, row);
                if (!row.Values.Has(x.Cell.Key))
                {
                    row.MissingValues = true;
                }
            });

            return row;
        }
Example #23
0
 public void ReadActual(object target, SetRow row)
 {
     row.Values[_accessor.Name] = _accessor.GetValue(target);
 }
Example #24
0
 public void SetUp()
 {
     matcher = new RowValueMatcher(new TestContext());
     row1 = new SetRow();
     row2 = new SetRow();
 }
Example #25
0
 public void ReadActual(object target, SetRow row)
 {
     row.Values[EXPECTED] = target;
 }
Example #26
0
 public void ReadExpected(ITestContext context, IStep step, SetRow row)
 {
     Cell.ReadArgument(context, step, x => row.Values[EXPECTED] = x);
 }