Exemple #1
0
 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);
 }
Exemple #2
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;
 }
Exemple #3
0
        public TypedValue Check(CellOperationValue actualValue, Tree<Cell> expectedCell) {
            var value = actualValue.GetActual(Processor);
            Processor.Get<Symbols>().Save(expectedCell.Value.Content.Substring(2), value);

            expectedCell.Value.SetAttribute(CellAttribute.InformationSuffix, value == null ? "null" : value.ToString());
            return TypedValue.Void;
        }
Exemple #4
0
 public TypedValue Check(CellOperationValue actualValue, Tree<Cell> expectedCell) {
     try {
         CheckEventuallyMatches(actualValue, expectedCell);
     }
     catch (IgnoredException) {}
     Processor.TestStatus.MarkCellWithLastResults(expectedCell.Value);
     return TypedValue.Void;
 }
        public TypedValue Check(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            var cell    = (Parse)expectedCell.Value;
            var matcher = new ListMatcher(Processor, new ArrayMatchStrategy(Processor, cell.Parts.Parts));

            matcher.MarkCell(actualValue.GetActual <IEnumerable>(Processor).Cast <object>(), cell.Parts, 0); //todo: encapsulate part in celloperationcontext??
            return(TypedValue.Void);
        }
Exemple #6
0
        public TypedValue Check(CellOperationValue actualValue, Tree<Cell> expectedCell)
        {
            var value = actualValue.GetActual(Processor);
            var symbol = new Symbol(expectedCell.Value.Text.Substring(2), value);
            Processor.Store(symbol);

            expectedCell.Value.AddToAttribute(CellAttribute.InformationSuffix, value == null ? "null" : value.ToString());
            return TypedValue.Void;
        }
Exemple #7
0
 public TypedValue Check(CellOperationValue actualValue, Tree<Cell> expectedCell)
 {
     try {
         var actual = actualValue.GetTypedActual(Processor);
         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);
     return TypedValue.Void;
 }
        public TypedValue Check(CellOperationValue actualValue, Tree <Cell> expectedCell)
        {
            var    cell          = (Parse)expectedCell.Value;
            var    expectedTable = new FixtureTable(cell.Parts);
            var    tables        = actualValue.GetActual <Parse>(Processor);
            var    actualTable   = new FixtureTable(tables);
            string differences   = actualTable.Differences(expectedTable);

            if (differences.Length == 0)
            {
                Processor.TestStatus.MarkRight(expectedCell.Value);
            }
            else
            {
                Processor.TestStatus.MarkWrong(expectedCell.Value, differences);
                cell.More = new Parse("td", string.Empty, tables, null);
            }
            return(TypedValue.Void);
        }
Exemple #9
0
 void DoCheckOperation(Parse theCells, bool isVolatile)
 {
     try {
         CellRange methodCells = CellRange.GetMethodCellRange(theCells, 1);
         try {
             processor.Operate <CheckOperator>(
                 CellOperationValue.Make(
                     fixture,
                     fixture.MethodRowSelector.SelectMethodCells(methodCells),
                     fixture.MethodRowSelector.SelectParameterCells(methodCells),
                     isVolatile),
                 theCells.Last);
         }
         catch (MemberMissingException e) {
             processor.TestStatus.MarkException(theCells.More, e);
         }
         catch (Exception e) {
             processor.TestStatus.MarkException(theCells.Last, e);
         }
     }
     catch (IgnoredException) {}
 }
 [Test] public void LastActionIsSetAsExpectedCellAttribute()
 {
     SetUpSUT("procedure");
     check.Check(CellOperationValue.Make(target.Value, new CellTreeLeaf("procedure"), new CellTree(), false), targetCell);
     Assert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded));
 }
Exemple #11
0
 public bool CanCheck(CellOperationValue actualValue, Tree<Cell> expectedCell) {
     return true;
 }
 public bool CanCheck(CellOperationValue actualValue, Tree<Cell> expectedCell)
 {
     return expectedCell.Value.Text.StartsWith(">>");
 }
Exemple #13
0
 public static bool IsMatch(CheckOperator checkOperator, string input)
 {
     return(checkOperator.CanCheck(CellOperationValue.Make(new TypedValue(null)),
                                   TestUtils.CreateCell(input)));
 }
Exemple #14
0
 public bool CanCheck(CellOperationValue actualValue, Tree<Cell> expectedCell)
 {
     return expectedCell.Value.Text.Length == 0
            && expectedCell.IsLeaf;
 }
 public class ParseModelOperator : CellOperator, CheckOperator, ParseOperator <Cell> { // todo: split, eliminate fit dependency
     public bool CanCheck(CellOperationValue actualValue, Tree <Cell> expectedCell)
     {
         return(typeof(Parse).IsAssignableFrom(actualValue.GetTypedActual(Processor).Type));
     }
Exemple #16
0
 public bool CanCheck(CellOperationValue actualValue, Tree<Cell> expectedCell) {
     return actualValue.IsVolatile;
 }
Exemple #17
0
 public void Check(TypedValue actualValue, Tree <Cell> expectedCell)
 {
     processor.Operate <CheckOperator>(
         CellOperationValue.Make(actualValue),
         expectedCell);
 }
Exemple #18
0
 public void Check(object systemUnderTest, Tree <Cell> memberName, Tree <Cell> parameters, Tree <Cell> expectedCell)
 {
     processor.Operate <CheckOperator>(
         CellOperationValue.Make(systemUnderTest, memberName, parameters),
         expectedCell);
 }