Esempio n. 1
0
        public T When(params IMessageMatcher[] endOfProcessSignals)
        {
            using (var yy = new BlockingAction(action, endOfProcessSignals.Union(new[] { messageToReturn }), actionExecutor, config.AssertOnMatchers, config.LogToConsole))
            {
                yy.Execute();
            }

            var asserter = asserterFactory.Create();

            if (config.AssertOnMatchers)
            {
                foreach (var matcher in endOfProcessSignals.Where(m => m.IsMatched))
                {
                    matcher.AssertOk(asserter);
                }

                foreach (var matcher in endOfProcessSignals.Where(m => !m.IsMatched))
                {
                    matcher.AssertOk(asserter);
                }
            }

            messageToReturn.AssertOk(asserter);

            asserter.ThrowIfFailed();

            return(messageToReturn.Match);
        }
        public void When(params IMessageMatcher[] endOfProcessSignals)
        {
            using (var yy = new BlockingAction(action, endOfProcessSignals, actionExecutor, config.AssertOnMatchers, config.LogToConsole))
            {
                yy.Execute();
            }

            if (config.AssertOnMatchers)
            {
                var asserter = asserterFactory.Create();

                foreach (var matcher in endOfProcessSignals.Where(m => m.IsMatched))
                {
                    matcher.AssertOk(asserter);
                }

                foreach (var matcher in endOfProcessSignals.Where(m => !m.IsMatched))
                {
                    matcher.AssertOk(asserter);
                }

                asserter.ThrowIfFailed();
            }
        }