示例#1
0
        public void CanStartAndEndBehaviorSpecification()
        {
            var depot = new RemoteTaskDepot(new RemoteTask[]
            {
                RemoteTaskFixtures.Context,
                RemoteTaskFixtures.Behavior1,
                RemoteTaskFixtures.Behavior1Specification1
            });
            var cache = new ElementCache(new ISpecificationElement[]
            {
                ElementFixtures.Behavior1Specification1
            });

            var sink    = Substitute.For <ITestExecutionSink>();
            var context = new RunContext(depot, sink);

            var listener = new TestExecutionListener(context, cache, CancellationToken.None);

            listener.OnContextStart(ElementFixtures.Context);
            listener.OnBehaviorStart(ElementFixtures.Behavior1);
            listener.OnSpecificationStart(ElementFixtures.Behavior1Specification1);
            listener.OnSpecificationEnd(ElementFixtures.Behavior1Specification1, string.Empty, new TestRunResult(TestStatus.Passing));
            listener.OnBehaviorEnd(ElementFixtures.Behavior1, string.Empty);
            listener.OnContextEnd(ElementFixtures.Context, string.Empty);

            sink.Received(1).TestStarting(RemoteTaskFixtures.Context);
            sink.Received(1).TestStarting(RemoteTaskFixtures.Behavior1);
            sink.Received(1).TestStarting(RemoteTaskFixtures.Behavior1Specification1);
            sink.Received(1).TestFinished(RemoteTaskFixtures.Behavior1Specification1, Arg.Any <string>(), TestResult.Success);
            sink.Received(1).TestFinished(RemoteTaskFixtures.Behavior1, Arg.Any <string>(), TestResult.Success);
            sink.Received(1).TestFinished(RemoteTaskFixtures.Context, Arg.Any <string>(), TestResult.Success);
        }
示例#2
0
        public void CanStartAndEndContext()
        {
            var depot = new RemoteTaskDepot(new RemoteTask[]
            {
                RemoteTaskFixtures.Context
            });
            var cache = new ElementCache(Array.Empty <ISpecificationElement>());

            var sink    = Substitute.For <ITestExecutionSink>();
            var context = new RunContext(depot, sink);

            var listener = new TestExecutionListener(context, cache, CancellationToken.None);

            listener.OnContextStart(ElementFixtures.Context);
            listener.OnContextEnd(ElementFixtures.Context, string.Empty);

            sink.Received(1).TestStarting(RemoteTaskFixtures.Context);
            sink.Received(1).TestFinished(RemoteTaskFixtures.Context, Arg.Any <string>(), TestResult.Success);
        }