Exemplo n.º 1
0
        public void Ensure_What_Right_Invoke()
        {
            var fakeProcessManager = new FakeProcessManager(States.First);

            fakeProcessManager.Raise(new FirstTestEvent());
            Assert.Equal(fakeProcessManager.CurrentState, States.Second);
            Assert.True(fakeProcessManager.InvokedForFirstEvent);
            Assert.False(fakeProcessManager.InvokedForSecondEvent);

            fakeProcessManager.Raise(new SecondTestEvent());
            Assert.Equal(fakeProcessManager.CurrentState, States.Mixed);
            Assert.True(fakeProcessManager.InvokedForSecondEvent);
            Assert.False(fakeProcessManager.InvokedForFirstEvent);

            fakeProcessManager.Raise(new SecondTestEvent());
            Assert.Equal(fakeProcessManager.CurrentState, States.Mixed);
            Assert.True(fakeProcessManager.InvokedForSecondEvent);
            Assert.False(fakeProcessManager.InvokedForFirstEvent);

            fakeProcessManager.Raise(new FirstTestEvent());
            Assert.Equal(fakeProcessManager.CurrentState, States.Completed);
            Assert.True(fakeProcessManager.InvokedForSecondEvent);
            Assert.True(fakeProcessManager.InvokedForFirstEvent);
        }
Exemplo n.º 2
0
        public void Ensure_What_Thrown_Exception_After_Fire_Not_Configured_EventHandler()
        {
            var fakeProcessManager = new FakeProcessManager(States.First);

            Assert.Throws <EventHandlerNotFoundException>(() => fakeProcessManager.Raise(new UselessTestEvent()));
        }