Exemple #1
0
        public void when_creating_the_actual_row()
        {
            var row = new SetRow();

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

            row.Values[StringSetComparer.EXPECTED].ShouldEqual("some text");
        }
Exemple #2
0
        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.As <ISetColumn>().ReadActual(table.Rows[0], row);
            _matchDistance.As <ISetColumn>().ReadActual(table.Rows[0], row);

            row.Values["City"].ShouldEqual("Austin");
            row.Values["Distance"].ShouldEqual(16);
        }
Exemple #4
0
        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");
        }
        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);
        }
Exemple #6
0
        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);
        }
        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.As <ISetColumn>().ReadExpected(context, step, row);
            _matchDistance.As <ISetColumn>().ReadExpected(context, step, row);

            row.Values["City"].ShouldEqual("Dallas");
            row.Values["Distance"].ShouldEqual(189);
        }
Exemple #8
0
        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);
            }
        }
        public void AddSet(ISetViewModel set)
        {
            using (var connection = DependencyService.Get <ISQLite>().GetConnection())
            {
                var setRow = new SetRow
                {
                    WorkOutId            = set.WorkOutId,
                    SetType              = (int)set.SetType,
                    SetName              = set.SetName,
                    CompletedRepetitions = set.CompletedRepetitions,
                    TotalRepetitions     = set.TotalRepetitions,
                    Weight = set.Weight
                };

                connection.Insert(setRow);

                set.SetId = setRow.SetId;
            }
        }
Exemple #10
0
 public void SetUp()
 {
     matcher = new RowValueMatcher(new TestContext());
     row1    = new SetRow();
     row2    = new SetRow();
 }