public void HandleMessage_MessageTypeIsCreate_ThrowsArgumentException()
        {
            var message = new BrokeredMessage();
            message.SetMessageType("Create");

            var executor = MockRepository.GenerateStub<IPowershellExecutor>();

            var messageHandler = new ReapMessageHandler(executor);

            Assert.That(() => messageHandler.HandleMessage(message), Throws.ArgumentException);
        }
        public void HandleMessage_VirtualMachineExists_PowershellIsInvokedTwice()
        {
            var message = new BrokeredMessage();
            message.SetMessageType("Delete");
            message.SetObject(new VirtualMachine { Name = "SomeName" });

            var executor = MockRepository.GenerateStub<IPowershellExecutor>();
            executor.Expect(x => x.Execute(Arg<PowerShellCommand[]>.Is.TypeOf))
                .Return(new[] { new PSObject() })
                .Repeat.Times(2);

            var messageHandler = new ReapMessageHandler(executor);

            messageHandler.HandleMessage(message);

            executor.VerifyAllExpectations();
        }