public void should_invoke_initializers_in_order(bool invertOrder)
        {
            var container = new Container();
            var initializers = Enumerable.Range(0, 10).Select(CreateMockInitializer).Reverse().ToArray();
            AddInitializersToContainer(container, initializers.Select(x => x.Object).ToArray());
            var setupSequence = new SetupSequence();
            (invertOrder ? initializers.Reverse() : initializers).ForEach(x => x.Setup(init => init.BeforeStart()).InSequence(setupSequence));

            container.CallActionOnInitializers(init => init.BeforeStart(), invertOrder);

            setupSequence.Verify();
        }
Beispiel #2
0
        public void should_stop_dispatcher_before_transport()
        {
            var transportMock = new Mock<ITransport>();
            var bus = new Bus(transportMock.Object, _directoryMock.Object, _messageSerializer, _messageDispatcherMock.Object, new DefaultStoppingStrategy());
            var sequence = new SetupSequence();
            _messageDispatcherMock.Setup(dispatch => dispatch.Stop()).InSequence(sequence);
            transportMock.Setup(transport => transport.Stop()).InSequence(sequence);
            bus.Configure(_self.Id, "test");

            bus.Start();
            bus.Stop();
            sequence.Verify();
        }
Beispiel #3
0
 public static IReturnsThrows <TMock, TResult> InSequence <TMock, TResult>(this ISetup <TMock, TResult> setup, SetupSequence sequence)
     where TMock : class
 {
     return(setup.Callback(sequence.GetCallback(setup.ToString())));
 }
Beispiel #4
0
 public static ICallbackResult InSequence <TMock>(this ISetup <TMock> setup, SetupSequence sequence)
     where TMock : class
 {
     return(setup.Callback(sequence.GetCallback(setup.ToString())));
 }