コード例 #1
0
        void SetUpSUT(string memberName)
        {
            this.memberName = memberName;
            testStatus      = new TestStatus();
            processor       = new Mock <CellProcessor>();
            execute         = new ExecuteDefault {
                Processor = processor.Object
            };
            check = new CheckDefault {
                Processor = processor.Object
            };
            memory = new TypeDictionary();

            target = new TypedValue("target");
            result = new TypedValue("result");

            targetCell = new CellTreeLeaf("stuff");

            processor
            .Setup(p => p.Parse(typeof(MemberName), It.IsAny <TypedValue>(), It.Is <CellTreeLeaf>(c => c.Text == memberName)))
            .Returns(new TypedValue(new MemberName(memberName)));
            processor
            .Setup(p => p.Invoke(target, It.Is <MemberName>(m => m.Name == "member"), It.Is <Tree <Cell> >(c => c.Branches.Count == 0)))
            .Returns(result);
            processor
            .Setup(p => p.Invoke(It.Is <TypedValue>(v => v.ValueString == "target"), It.Is <MemberName>(m => m.Name == "procedure"), It.IsAny <Tree <Cell> >()))
            .Returns((TypedValue t, MemberName m, Tree <Cell> c) => {
                testStatus.Counts.AddCount(TestStatus.Right);
                testStatus.LastAction = "blah blah";
                return(result);
            });
            processor.Setup(p => p.Compare(It.IsAny <TypedValue>(), It.IsAny <Tree <Cell> >())).Returns(true);
            processor.Setup(p => p.TestStatus).Returns(testStatus);
            processor.Setup(p => p.Memory).Returns(memory);
        }
コード例 #2
0
        void SetUpSUT(string memberName) {
            this.memberName = memberName;
            testStatus = new TestStatus();
            processor = new Mock<CellProcessor>();
            execute = new ExecuteDefault { Processor = processor.Object};
            check = new CheckDefault {Processor = processor.Object};
            memory = new TypeDictionary();

            target = new TypedValue("target");
            result = new TypedValue("result");

            targetCell = new CellTreeLeaf("stuff");

            processor
                .Setup(p => p.Parse(typeof (MemberName), It.IsAny<TypedValue>(), It.Is<CellTreeLeaf>(c => c.Text == memberName)))
                .Returns(new TypedValue(new MemberName(memberName)));
            processor
                .Setup(p => p.Invoke(target, It.Is<MemberName>(m => m.Name == "member"), It.Is<Tree<Cell>>(c => c.Branches.Count == 0)))
                .Returns(result);
            processor
                .Setup(p => p.Invoke(It.Is<TypedValue>(v => v.ValueString == "target"), It.Is<MemberName>(m => m.Name == "procedure"), It.IsAny<Tree<Cell>>()))
                .Returns((TypedValue t, MemberName m, Tree<Cell> c) => {
                    testStatus.Counts.AddCount(TestStatus.Right);
                    testStatus.LastAction = "blah blah";
                    return result;
                });
            processor.Setup(p => p.Compare(It.IsAny<TypedValue>(), It.IsAny<Tree<Cell>>())).Returns(true);
            processor.Setup(p => p.TestStatus).Returns(testStatus);
            processor.Setup(p => p.Memory).Returns(memory);
        }
コード例 #3
0
ファイル: TestStatusTest.cs プロジェクト: ChrisBDFA/fitsharp
 static void AssertAbandonsSuite(Exception exception) {
     var status = new fitSharp.Fit.Model.TestStatus();
     Assert.IsFalse(status.SuiteIsAbandoned);
     try {
         status.MarkException(new CellBase("test"), exception);
     }
     catch (AbandonSuiteException) {}
     Assert.IsTrue(status.SuiteIsAbandoned);
 }
コード例 #4
0
        static void AssertAbandonsSuite(Exception exception)
        {
            var status = new fitSharp.Fit.Model.TestStatus();

            Assert.IsFalse(status.SuiteIsAbandoned);
            try {
                status.MarkException(new CellBase("test"), exception);
            }
            catch (AbandonSuiteException) {}
            Assert.IsTrue(status.SuiteIsAbandoned);
        }