public SeleniumFlowTestRunner( IWebDriverFactory webDriverFactory, IPathResolverStrategy <IState, ITransition> pathResolverStrategy, IPathTestStrategyFactory pathTestStrategyFactory, IEventPublisherFactory publisherFactory) { this.webDriverFactory = webDriverFactory; this.pathResolverStrategy = pathResolverStrategy; this.pathTestStrategyFactory = pathTestStrategyFactory; this.publisherFactory = publisherFactory; this.publisher = publisherFactory.Create <SeleniumFlowTestRunner>(); }
public Test GetTest(Path <Guid, IState, ITransition> path, IEventPublisherFactory publisherFactory) { var executableActions = new List <IExecutableAction>(); var pathEdges = path.Edges.ToList(); for (var i = 0; i < pathEdges.Count; i++) { var edge = pathEdges[i]; if (edge.Target is IDecision) { var nextEdge = pathEdges[i + 1]; executableActions.Add(this.GetExecutableAction(nextEdge)); } else if (edge.Source is IDecision) { var previousEdge = pathEdges[i - 1]; executableActions.Add(this.GetExecutableAction(previousEdge)); } else { executableActions.Add(this.GetExecutableAction(edge)); } } var endScreen = pathEdges.LastOrDefault()?.Target; if (endScreen == null) { throw new InvalidOperationException("No end screen found."); } var query = this.queryResolver.GetQuery(endScreen); if (query == null) { throw new InvalidOperationException( $"The end screen {endScreen.GetType()} does not have a query defined"); } return(new Test(path.ToString(), executableActions, query, publisherFactory)); }
public Test(string name, IEnumerable <IExecutableAction> actions, IQuery query, IEventPublisherFactory publisherFactory) { if (query == null) { throw new ArgumentNullException(nameof(query)); } if (publisherFactory == null) { throw new ArgumentNullException(nameof(publisherFactory)); } this.Name = name; this.actions = actions; this.Query = query; this.publisher = publisherFactory.Create <Test>(); }
public BuyConcertTicketsCommandHandler(IConcertRepository concertRepository, IEventPublisherFactory eventHandlerFactory, ILogger logger) { ConcertRepository = concertRepository; EventHandlerFactory = eventHandlerFactory; Logger = logger; }