예제 #1
0
        public void right(ICellWrapper <Parse> expected, RestDataTypeAdapter typeAdapter)
        {
            string expectedContent = expected.body();

            expected.body(Tools.HtmlTools.makeContentForRightCell(expectedContent, typeAdapter, this, minLenForToggle));
            fixture.Right(expected.Wrapped);
        }
예제 #2
0
        public void wrong(ICellWrapper <String> expected, RestDataTypeAdapter ta)
        {
            string expectedContent = expected.body();

            expected.body(Tools.HtmlTools.makeContentForWrongCell(expectedContent, ta, this, minLenForToggle));
            expected.body("fail:" + HtmlTools.wrapInDiv(expected.body()));
        }
예제 #3
0
        public override void DoCells(Parse parse)
        {
            if (restFixture == null)
            {
                restFixture        = new CommonRestFixture <Parse>(this.Symbols);
                restFixture.Config = Config.getConfig(ConfigNameFromArgs);
                string url = BaseUrlFromArgs;
                if (url != null)
                {
                    restFixture.BaseUrl = new Url(HtmlTools.fromSimpleTag(url));
                }
                restFixture.initialize(Runner.FIT);
                ((FitFormatter)restFixture.Formatter).ActionFixtureDelegate = this;
            }
            IRowWrapper <Parse> currentRow = new FitRow(parse);

            try
            {
                restFixture.Formatter.DisplayActual = restFixture.displayActualOnRight;
                restFixture.processRow(currentRow);
            }
            catch (Exception exception)
            {
                // TODO: Sort out CellWrapper vs CellWrapper<Parse>.
                ICellWrapper <Parse> firstCell = currentRow.getCell(0);
                LOG.Error(exception, "Exception when processing row {0}", firstCell.text());
                ICellFormatter <Parse> cellFormatter = restFixture.Formatter;
                cellFormatter.exception(firstCell, exception);
            }
        }
예제 #4
0
        public void wrong(ICellWrapper <Parse> expected, RestDataTypeAdapter typeAdapter)
        {
            string expectedContent = expected.body();
            string body            = Tools.HtmlTools.makeContentForWrongCell(expectedContent, typeAdapter, this, minLenForToggle);

            expected.body(body);
            fixture.Wrong(expected.Wrapped);
        }
예제 #5
0
        public void exception(ICellWrapper <String> cell, Exception exception)
        {
            //String m = Tools.toHtml(cell.getWrapped() + "\n-----\n") + Tools.toCode(Tools.toHtml(out.toString()));
            string m = HtmlTools.toHtml(cell.Wrapped + "\n-----\n") + HtmlTools.toCode(HtmlTools.toHtml(exception.ToString()));

            cell.body("error:" + HtmlTools.wrapInDiv(m));
            //cell.body("error:" + m);
        }
예제 #6
0
 public virtual ICellWrapper <string> removeCell(int c)
 {
     if (c < this.row.Count)
     {
         ICellWrapper <string> removedCell = this.row[c];
         this.row.Remove(removedCell);
         return(removedCell);
     }
     return(null);
 }
예제 #7
0
        /// <param name="c"> the cell index </param>
        /// <returns> the <seealso cref="ICellWrapper{T}"/> at a given position </returns>
        public ICellWrapper <string> getCell(int c)
        {
            ICellWrapper <string> cellWrapper =
                Mock.Of <ICellWrapper <string> >(wrapper =>
                                                 wrapper.Wrapped == _cells[c] &&
                                                 wrapper.text() == _cells[c] &&
                                                 wrapper.body() == _cells[c]);

            return(cellWrapper);
        }
예제 #8
0
        public void asLink(ICellWrapper <Parse> cell, string resolvedUrl, string link, string text)
        {
            string actualText = text;
            string parsed     = null;

            if (displayAbsoluteURLInFull)
            {
                parsed = HtmlTools.fromSimpleTag(resolvedUrl);
                if (parsed.Trim().StartsWith("http", StringComparison.Ordinal))
                {
                    actualText = parsed;
                }
            }
            cell.body(HtmlTools.toHtmlLink(link, actualText));
        }
예제 #9
0
        public void check(ICellWrapper <Parse> expected, RestDataTypeAdapter actual)
        {
            if (string.IsNullOrWhiteSpace(expected.body()))
            {
                if (actual.Actual == null)
                {
                    return;
                }
                else
                {
                    expected.body(gray(actual.Actual.ToString()));
                    return;
                }
            }

            if (actual.Actual != null && actual.Equals(expected.body(), actual.Actual.ToString()))
            {
                right(expected, actual);
            }
            else
            {
                wrong(expected, actual);
            }
        }
예제 #10
0
        public void exception(ICellWrapper <Parse> cell, Exception exception)
        {
            Parse wrapped = cell.Wrapped;

            fixture.Exception(wrapped, exception);
        }
예제 #11
0
        public void exception(ICellWrapper <Parse> cell, string exceptionMessage)
        {
            Parse wrapped = cell.Wrapped;

            fixture.Exception(wrapped, new FitFailureException(exceptionMessage));
        }
예제 #12
0
 public void exception(ICellWrapper <String> cell, string exceptionMessage)
 {
     cell.body("error:" + HtmlTools.wrapInDiv(exceptionMessage));
 }
예제 #13
0
 public void right(ICellWrapper <String> expected, RestDataTypeAdapter typeAdapter)
 {
     expected.body("pass:" + HtmlTools.wrapInDiv(Tools.HtmlTools.makeContentForRightCell(expected.body(), typeAdapter, this, minLenForToggle)));
 }