CodeValue.CodeCommander.Tests.CommandProcessorTests.CommandPublish_CommandHasBeforeExecutingAction_ActionCalled C# (CSharp) Méthode

CommandPublish_CommandHasBeforeExecutingAction_ActionCalled() private méthode

        public void CommandPublish_CommandHasBeforeExecutingAction_ActionCalled()
        {
            var actionCalled = false;
            var resetEvent = new ManualResetEventSlim(false);

            var fakeFilterManager = A.Fake<IFilterManager>();
            A.CallTo(() => fakeFilterManager.Process(A<CommandBase>.Ignored)).Returns(true);

            var processor = new CommandProcessor(null, fakeFilterManager);
            var command = new TestCommand(CommandState.New, beforeExecuteAction: i =>
                                                                                 {
                                                                                     actionCalled = true;
                                                                                     resetEvent.Set();
                                                                                 });
            processor.PublishCommand(command);

            resetEvent.Wait();

            Assert.IsTrue(actionCalled);
        }
CommandProcessorTests