示例#1
0
        public TypedValue Check(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            try {
                Processor.Get <Logging>().BeginCell(expectedCell.Value);
                TypedValue actual;
                try {
                    actual = actualValue.GetTypedActual(Processor);
                }
                finally {
                    Processor.Get <Logging>().EndCell(expectedCell.Value);
                }

                if (Processor.Compare(actual, expectedCell))
                {
                    Processor.TestStatus.MarkRight(expectedCell.Value);
                }
                else
                {
                    var actualCell = Processor.Compose(actual);
                    Processor.TestStatus.MarkWrong(expectedCell.Value, actualCell.Value.Text);
                }
            }
            catch (IgnoredException) {}
            Processor.TestStatus.MarkCellWithLastResults(expectedCell.Value);
            return(TypedValue.Void);
        }
        void CheckEventuallyMatches(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            var        wait     = Processor.Get <Symbols>().GetValueOrDefault <int>("WaitFor.Time", defaultWaitTime);
            var        maxCount = Processor.Get <Symbols>().GetValueOrDefault <int>("WaitFor.Count", defaultWaitCount);
            var        sleep    = 0;
            TypedValue actual   = TypedValue.Void;

            for (var count = 0; count < maxCount; count++)
            {
                Processor.Get <Logging>().BeginCell(expectedCell.Value);
                try {
                    actual = actualValue.GetTypedActual(Processor);
                }
                finally {
                    Processor.Get <Logging>().EndCell(expectedCell.Value);
                }
                if (Processor.Compare(actual, expectedCell))
                {
                    Processor.TestStatus.MarkRight(expectedCell.Value);
                    return;
                }
                var sleepThisTime = (wait * count) / maxCount - sleep;
                if (sleepThisTime <= 0)
                {
                    continue;
                }
                Thread.Sleep(sleepThisTime);
                sleep += sleepThisTime;
            }
            var actualCell = Processor.Compose(actual);

            Processor.TestStatus.MarkWrong(expectedCell.Value, actualCell.Value.Text);
        }
示例#3
0
        public TypedValue Check(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            var actualCell = Processor.Compose(actualValue.GetTypedActual(Processor));

            expectedCell.Value.AddToAttribute(CellAttribute.InformationSuffix,
                                              actualCell.Value.Text.Length == 0 ? "blank" : actualCell.Value.Text); // slightly quirky behavior from original fitnesse.net
            return(TypedValue.Void);
        }
示例#4
0
        void CheckEventuallyMatches(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            var wait = Processor.Memory.GetItem <Settings>().WaitTime;

            if (wait == 0)
            {
                wait = defaultWaitTime;
            }
            var        sleep  = 0;
            TypedValue actual = TypedValue.Void;

            for (var count = 0; count < 100; count++)
            {
                Processor.Get <Logging>().BeginCell(expectedCell.Value);
                try {
                    actual = actualValue.GetTypedActual(Processor);
                }
                finally {
                    Processor.Get <Logging>().EndCell(expectedCell.Value);
                }
                if (Processor.Compare(actual, expectedCell))
                {
                    Processor.TestStatus.MarkRight(expectedCell.Value);
                    return;
                }
                var sleepThisTime = (wait * count) / 100 - sleep;
                if (sleepThisTime <= 0)
                {
                    continue;
                }
                Thread.Sleep(sleepThisTime);
                sleep += sleepThisTime;
            }
            var actualCell = Processor.Compose(actual);

            Processor.TestStatus.MarkWrong(expectedCell.Value, actualCell.Value.Text);
        }