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

PublishCommand_CommandShouldFailWhenFiltered_CommandFailed() private méthode

        public void PublishCommand_CommandShouldFailWhenFiltered_CommandFailed()
        {
            var fakeFilterManager = A.Fake<IFilterManager>();
            var processor = new CommandProcessor(null, fakeFilterManager);

            var evt = new ManualResetEventSlim(false);
            var command = new TestCommand(CommandState.New, shouldFailIfFiltered: true);

            command.RegisterForStateChange(Observer.Create<CommandState>(b =>
            {
                if (b == CommandState.Failed)
                {
                    evt.Set();
                }
            }));

            processor.PublishCommand(command);

            evt.Wait();

            Assert.AreEqual(CommandState.Failed, command.CurrentState);
        }
CommandProcessorTests