//using System; //using System.Collections.Generic; //using Moq; //using NUnit.Framework; //using NzbDrone.Common; //using NzbDrone.Core.Messaging.Commands; //using NzbDrone.Core.Messaging.Commands.Tracking; //using NzbDrone.Core.Messaging.Events; //using NzbDrone.Test.Common; // //namespace NzbDrone.Core.Test.Messaging.Commands //{ // [TestFixture] // public class CommandExecutorFixture : TestBase // { // private Mock> _executorA; // private Mock> _executorB; // // [SetUp] // public void Setup() // { // _executorA = new Mock>(); // _executorB = new Mock>(); // // Mocker.GetMock() // .Setup(c => c.Build(typeof(IExecute))) // .Returns(_executorA.Object); // // Mocker.GetMock() // .Setup(c => c.Build(typeof(IExecute))) // .Returns(_executorB.Object); // // // Mocker.GetMock() // .Setup(c => c.FindExisting(It.IsAny())) // .Returns(null); // } // // [Test] // public void should_publish_command_to_executor() // { // var commandA = new CommandA(); // // Subject.Push(commandA); // // _executorA.Verify(c => c.Execute(commandA), Times.Once()); // } // // [Test] // public void should_publish_command_by_with_optional_arg_using_name() // { // Mocker.GetMock().Setup(c => c.GetImplementations(typeof(Command))) // .Returns(new List { typeof(CommandA), typeof(CommandB) }); // // Subject.Push(typeof(CommandA).FullName); // _executorA.Verify(c => c.Execute(It.IsAny()), Times.Once()); // } // // // [Test] // public void should_not_publish_to_incompatible_executor() // { // var commandA = new CommandA(); // // Subject.Push(commandA); // // _executorA.Verify(c => c.Execute(commandA), Times.Once()); // _executorB.Verify(c => c.Execute(It.IsAny()), Times.Never()); // } // // [Test] // public void broken_executor_should_throw_the_exception() // { // var commandA = new CommandA(); // // _executorA.Setup(c => c.Execute(It.IsAny())) // .Throws(new NotImplementedException()); // // Assert.Throws(() => Subject.Push(commandA)); // } // // // [Test] // public void broken_executor_should_publish_executed_event() // { // var commandA = new CommandA(); // // _executorA.Setup(c => c.Execute(It.IsAny())) // .Throws(new NotImplementedException()); // // Assert.Throws(() => Subject.Push(commandA)); // // VerifyEventPublished(); // } // // [Test] // public void should_publish_executed_event_on_success() // { // var commandA = new CommandA(); // Subject.Push(commandA); // // VerifyEventPublished(); // } // } // // public class CommandA : Command // { // public CommandA(int id = 0) // { // } // } // // public class CommandB : Command // { // // public CommandB() // { // } // } // //}