public async Task IntegrationTestOrderAttack_MergeWithExisting()
        {
            // Arrange
            CommandQueue           repository         = new CommandQueue(DevelopmentStorageAccountConnectionString);
            Guid                   targetRegionGuid   = new Guid("7E3BCD95-EB8B-4401-A987-F613A3428676");
            Guid                   initialOperationId = Guid.NewGuid();
            CommandQueueTableEntry newCommand         = CommandQueueTableEntry.CreateAttackMessage(initialOperationId, SessionGuid, SessionPhaseGuid, RegionGuid, "DummyEtag", targetRegionGuid, 5U);

            CommandTable.Execute(TableOperation.Insert(newCommand));

            // Act
            Guid operationGuid;

            using (IBatchOperationHandle batchOperation = new BatchOperationHandle(CommandTable))
            {
                operationGuid = await repository.OrderAttack(batchOperation, SessionGuid, SessionPhaseGuid, RegionGuid, "DummyEtag", targetRegionGuid, 4U);
            }

            // Assert
            var operation = TableOperation.Retrieve <CommandQueueTableEntry>(SessionGuid.ToString(), "Command_" + RegionGuid.ToString() + "_" + targetRegionGuid.ToString());
            var result    = await CommandTable.ExecuteAsync(operation);

            CommandQueueTableEntry queuedCommand = result.Result as CommandQueueTableEntry;

            Assert.IsNotNull(queuedCommand);
            Assert.AreEqual(operationGuid, queuedCommand.OperationId);
            Assert.AreNotEqual(operationGuid, initialOperationId);
            Assert.AreEqual(SessionGuid, queuedCommand.SessionId);
            Assert.AreEqual(SessionPhaseGuid, queuedCommand.PhaseId);
            Assert.AreEqual(CommandQueueMessageType.Attack, queuedCommand.MessageType);
            Assert.AreEqual(RegionGuid, queuedCommand.SourceRegion);
            Assert.AreEqual("DummyEtag", queuedCommand.SourceRegionEtag);
            Assert.AreEqual(targetRegionGuid, queuedCommand.TargetRegion);
            Assert.AreEqual(9U, queuedCommand.NumberOfTroops);
        }
        public async Task IntegrationTestOrderAttack()
        {
            // Arrange
            CommandQueue repository       = new CommandQueue(DevelopmentStorageAccountConnectionString);
            Guid         targetRegionGuid = new Guid("8449A25B-363D-4F01-B3D9-7EF8C5D42047");

            // Act
            Guid operationGuid;

            using (IBatchOperationHandle batchOperation = new BatchOperationHandle(CommandTable))
            {
                operationGuid = await repository.OrderAttack(batchOperation, SessionGuid, SessionPhaseGuid, RegionGuid, "DummyEtag", targetRegionGuid, 5U);
            }

            // Assert
            var operation = TableOperation.Retrieve <CommandQueueTableEntry>(SessionGuid.ToString(), "Command_" + RegionGuid.ToString() + "_" + targetRegionGuid.ToString());
            var result    = await CommandTable.ExecuteAsync(operation);

            CommandQueueTableEntry queuedCommand = result.Result as CommandQueueTableEntry;

            Assert.IsNotNull(queuedCommand);
            Assert.AreEqual(operationGuid, queuedCommand.OperationId);
            Assert.AreEqual(SessionGuid, queuedCommand.SessionId);
            Assert.AreEqual(SessionPhaseGuid, queuedCommand.PhaseId);
            Assert.AreEqual(CommandQueueMessageType.Attack, queuedCommand.MessageType);
            Assert.AreEqual(RegionGuid, queuedCommand.SourceRegion);
            Assert.AreEqual("DummyEtag", queuedCommand.SourceRegionEtag);
            Assert.AreEqual(targetRegionGuid, queuedCommand.TargetRegion);
            Assert.AreEqual(5U, queuedCommand.NumberOfTroops);
        }