|
| 1 | +using System; |
| 2 | +using System.Linq.Expressions; |
| 3 | +using BeekmanLabs.UnitTesting; |
| 4 | +using InEngine.Commands; |
| 5 | +using InEngine.Core.Commands; |
| 6 | +using InEngine.Core.Queuing; |
| 7 | +using Moq; |
| 8 | +using NUnit.Framework; |
| 9 | +using Serialize.Linq.Extensions; |
| 10 | + |
| 11 | +namespace InEngine.Core.Test.Queuing |
| 12 | +{ |
| 13 | + [TestFixture] |
| 14 | + public class EnqueueTest : TestBase |
| 15 | + { |
| 16 | + public Mock<QueueAdapter> MockQueueAdapter { get; set; } |
| 17 | + |
| 18 | + //[SetUp] |
| 19 | + //public void Setup() |
| 20 | + //{ |
| 21 | + // InEngineSettings.BasePath = TestContext.CurrentContext.TestDirectory; |
| 22 | + // MockQueueClient = new Mock<IQueueClient>(); |
| 23 | + // Subject.QueueClient = MockQueueClient.Object; |
| 24 | + //} |
| 25 | + |
| 26 | + //[Test] |
| 27 | + //public void ShouldPublishCommand() |
| 28 | + //{ |
| 29 | + // var command = new AlwaysSucceed(); |
| 30 | + // MockQueueClient.Setup(x => x.Publish(command)); |
| 31 | + |
| 32 | + // Subject.Publish(command); |
| 33 | + |
| 34 | + // MockQueueClient.Verify(x => x.Publish(command), Times.Once()); |
| 35 | + //} |
| 36 | + |
| 37 | + //[Test] |
| 38 | + //public void ShouldPublishLambdaCommand() |
| 39 | + //{ |
| 40 | + // Expression<Action> expression = () => Console.Write("Hello, world."); |
| 41 | + // var lambda = new Lambda(expression.ToExpressionNode()); |
| 42 | + // MockQueueClient.Setup(x => x.Publish(It.IsAny<Lambda>())); |
| 43 | + |
| 44 | + // Subject.Publish(lambda); |
| 45 | + |
| 46 | + // MockQueueClient.Verify(x => x.Publish(It.IsAny<Lambda>()), Times.Once()); |
| 47 | + //} |
| 48 | + |
| 49 | + //[Test] |
| 50 | + //public void ShouldPublishChainOfCommands() |
| 51 | + //{ |
| 52 | + // var commands = new[] { |
| 53 | + // new AlwaysSucceed(), |
| 54 | + // new AlwaysSucceed(), |
| 55 | + // new AlwaysSucceed(), |
| 56 | + // new AlwaysSucceed(), |
| 57 | + // }; |
| 58 | + // MockQueueClient.Setup(x => x.Publish(It.IsAny<Chain>())); |
| 59 | + |
| 60 | + // Subject.Publish(commands); |
| 61 | + |
| 62 | + // MockQueueClient.Verify(x => x.Publish(It.Is<Chain>(y => y.Commands.Equals(commands))), Times.Once()); |
| 63 | + //} |
| 64 | + } |
| 65 | +} |
0 commit comments