public override async Task <bool> Invoke( TestContext ctx, TestInstance instance, CancellationToken cancellationToken) { if ((Path.Flags & TestFlags.FlattenHierarchy) != 0) { return(await InvokeInner(ctx, instance, Inner, cancellationToken)); } var currentPath = TestInstance.GetCurrentPath(instance); var innerName = currentPath.Name; var innerResult = new TestResult(innerName); innerResult.Path = currentPath; var innerCtx = ctx.CreateChild(innerResult.Name, currentPath, innerResult); bool success; try { success = await InvokeInner(innerCtx, instance, Inner, cancellationToken); } finally { ctx.Result.AddChild(innerResult); } return(success); }
public override async Task <bool> Invoke( TestContext ctx, TestInstance instance, CancellationToken cancellationToken) { if ((Flags & (TestFlags.Hidden | TestFlags.FlattenHierarchy)) != 0) { return(await InvokeInner(ctx, instance, Inner, cancellationToken)); } TestContext innerCtx; TestResult innerResult; var currentPath = instance.GetCurrentPath(); innerResult = new TestResult(currentPath); innerCtx = ctx.CreateChild(currentPath, innerResult); bool success; try { success = await InvokeInner(innerCtx, instance, Inner, cancellationToken); } finally { ctx.Result.AddChild(innerResult); } return(success); }
protected TestInstance(TestHost host, TestNode node, TestInstance parent) { if (host == null) { throw new ArgumentNullException("host"); } if (node == null) { throw new ArgumentNullException("node"); } Host = host; Node = node; Parent = parent; ParentPath = Parent?.GetCurrentPath(); Path = new TestPath(ParentPath, Node); }
public static TestPath GetCurrentPath(TestInstance instance) { return(instance.GetCurrentPath()); }