public void BoundElementsAreRunnable() { var depot = new RemoteTaskDepot(new RemoteTask[] { RemoteTaskFixtures.Context, RemoteTaskFixtures.Behavior1, RemoteTaskFixtures.Specification1, RemoteTaskFixtures.Behavior1Specification1 }); depot.Bind(ElementFixtures.Context, RemoteTaskFixtures.Context); depot.Bind(ElementFixtures.Behavior1, RemoteTaskFixtures.Behavior1); depot.Bind(ElementFixtures.Specification1, RemoteTaskFixtures.Specification1); depot.Bind(ElementFixtures.Behavior1Specification1, RemoteTaskFixtures.Behavior1Specification1); var selected = depot.GetTestsToRun().ToArray(); CollectionAssert.Contains(selected, ElementFixtures.Specification1); CollectionAssert.Contains(selected, ElementFixtures.Behavior1Specification1); }
public void Discover() { logger.Info($"Discovering tests from {request.Container.Location}"); var source = new List <RemoteTask>(); try { var discoverySink = new MspecDiscoverySink(token); controller.Find(discoverySink, request.Container.Location); foreach (var element in discoverySink.Elements.Result) { var task = GetRemoteTask(element); var parent = GetParent(element); source.Add(task); if (parent != null && depot[element] == null && depot[parent] != null && depot[parent] !.RunAllChildren) { depot.Add(task); } depot.Bind(element, task); } if (source.Any()) { logger.Debug($"Sending {source.Count} discovery results to server"); sink.TestsDiscovered(source.ToArray()); } } catch (OperationCanceledException) { logger.Info("Discovery was aborted"); } catch (TargetInvocationException ex) when(ex.InnerException != null) { throw new MspecDiscoveryException(ex.InnerException.Message, ex.InnerException.StackTrace); } catch (Exception ex) when(ex.GetType().FullName.StartsWith("Machine.Specifications")) { throw new MspecDiscoveryException(ex.Message, ex.StackTrace); } logger.Info("Discovery completed"); }