Ejemplo n.º 1
0
 internal static FixtureResult GetFixtureResult(HookBinding hook)
 {
     return(new FixtureResult
     {
         name = $"{hook.Method.Name} [{hook.HookOrder}]"
     });
 }
 private void StartFixture(HookBinding hook, string containerId)
 {
     if (hook.HookType.ToString().StartsWith("Before"))
     {
         allure.StartBeforeFixture(containerId, AllureHelper.NewId(), AllureHelper.GetFixtureResult(hook));
     }
     else
     {
         allure.StartAfterFixture(containerId, AllureHelper.NewId(), AllureHelper.GetFixtureResult(hook));
     }
 }
Ejemplo n.º 3
0
 private void StartFixture(HookBinding hook, string containerId)
 {
     if (hook.HookType.ToString().StartsWith("Before"))
     {
         AllureLifecycle.Instance.StartBeforeFixture(containerId, PluginHelper.NewId(), PluginHelper.GetFixtureResult(hook));
     }
     else
     {
         AllureLifecycle.Instance.StartAfterFixture(containerId, PluginHelper.NewId(), PluginHelper.GetFixtureResult(hook));
     }
 }
Ejemplo n.º 4
0
        public void GetHooks_should_return_all_hooks()
        {
            var sut = new BindingRegistry();

            var hook1 = new HookBinding(new Mock <IBindingMethod>().Object, HookType.BeforeScenario, null, 1);
            var hook2 = new HookBinding(new Mock <IBindingMethod>().Object, HookType.AfterFeature, null, 2);

            sut.RegisterHookBinding(hook1);
            sut.RegisterHookBinding(hook2);

            var result = sut.GetHooks();

            result.Should().BeEquivalentTo(hook1, hook2);
        }
Ejemplo n.º 5
0
        public void Should_publish_hook_binding_events()
        {
            var      hookType            = HookType.AfterScenario;
            TimeSpan expectedDuration    = TimeSpan.FromSeconds(5);
            var      expectedHookBinding = new HookBinding(new Mock <IBindingMethod>().Object, hookType, null, 1);

            methodBindingInvokerMock.Setup(i => i.InvokeBinding(expectedHookBinding, contextManagerStub.Object, It.IsAny <object[]>(), testTracerStub.Object, out expectedDuration));
            var testExecutionEngine = CreateTestExecutionEngine();

            testExecutionEngine.InvokeHook(methodBindingInvokerMock.Object, expectedHookBinding, hookType);

            _testThreadExecutionEventPublisher.Verify(te =>
                                                      te.PublishEvent(It.Is <HookBindingStartedEvent>(e =>
                                                                                                      e.HookBinding.Equals(expectedHookBinding))),
                                                      Times.Once);
            _testThreadExecutionEventPublisher.Verify(te =>
                                                      te.PublishEvent(It.Is <HookBindingFinishedEvent>(e =>
                                                                                                       e.HookBinding.Equals(expectedHookBinding) &&
                                                                                                       e.Duration.Equals(expectedDuration))),
                                                      Times.Once);
        }
Ejemplo n.º 6
0
 internal static FixtureResult GetFixtureResult(HookBinding hook) => new FixtureResult()
 {
     name = $"{ hook.Method.Name} [{hook.HookOrder}]"
 };