Exemple #1
0
            /// <inheritdoc />
            public async Task RunAsync(ITestOutputHelper testOutputHelper)
            {
                var spf = StepFactoryStore.Create();

                var loggerFactory = TestLoggerFactory.Create();

                loggerFactory.AddXunit(testOutputHelper);

                var logger = loggerFactory.CreateLogger("Test");
                var repo   = new MockRepository(MockBehavior.Strict);

                var context = ExternalContextSetupHelper.GetExternalContext(repo);

                var sclRunner = new SCLRunner(
                    SCLSettings.EmptySettings,
                    logger,
                    spf,
                    context
                    );

                var r = await sclRunner.RunSequenceFromTextAsync(
                    SCL,
                    new Dictionary <string, object>(),
                    CancellationToken.None
                    );

                r.ShouldBeSuccessful();

                loggerFactory.Sink.LogEntries.Should().SatisfyRespectively(ExpectedLogs);
            }
Exemple #2
0
            /// <inheritdoc />
            public async Task RunAsync(ITestOutputHelper testOutputHelper)
            {
                testOutputHelper.WriteLine(SCL);

                var stepFactoryStore = StepFactoryStore.Create();
                var loggerFactory    = TestLoggerFactory.Create();

                loggerFactory.AddXunit(testOutputHelper);
                var repository = new MockRepository(MockBehavior.Strict);

                var externalContext = ExternalContextSetupHelper.GetExternalContext(repository);

                var runner = new SCLRunner(
                    SCLSettings.EmptySettings,
                    loggerFactory.CreateLogger("Test"),
                    stepFactoryStore,
                    externalContext
                    );

                var result = await runner.RunSequenceFromTextAsync(
                    SCL,
                    new Dictionary <string, object>(),
                    CancellationToken.None
                    );

                result.ShouldBeSuccessful();

                LogChecker.CheckLoggedValues(
                    loggerFactory,
                    LogLevel.Information,
                    ExpectedLoggedValues
                    );
            }
Exemple #3
0
            public virtual async Task <StateMonad> GetStateMonad(
                MockRepository mockRepository,
                ILogger logger)
            {
                var externalContext = ExternalContextSetupHelper.GetExternalContext(mockRepository);

                var tStepAssembly = Assembly.GetAssembly(typeof(TStep)) !;

                var sfs = StepFactoryStoreToUse.Unwrap(
                    StepFactoryStore.Create(Settings, tStepAssembly)
                    );

                var stateMonad = new StateMonad(
                    logger,
                    Settings,
                    sfs,
                    externalContext,
                    new Dictionary <string, object>()
                    );

                foreach (var action in InitialStateActions)
                {
                    await action(stateMonad);
                }

                return(stateMonad);
            }
Exemple #4
0
            public IntegrationTestCase(string name, IStep <Unit> steps) : base(name, new List <string>())
            {
                Steps              = steps;
                IgnoreFinalState   = true;
                IgnoreLoggedValues = true;

                var connectorInjections = new IConnectorInjection[]
                {
                    new ConnectorInjection(), new FileSystem.ConnectorInjection()
                };

                foreach (var connectorInjection in connectorInjections)
                {
                    var injectedContextsResult = connectorInjection.TryGetInjectedContexts(Settings);
                    injectedContextsResult.ShouldBeSuccessful();

                    foreach (var(contextName, context) in injectedContextsResult.Value)
                    {
                        ExternalContextSetupHelper.AddContextObject(contextName, context);
                    }
                }
            }