public void HandleMessage_MessageTypeIsCreate_ThrowsArgumentException() { var message = new BrokeredMessage(); message.SetMessageType("Delete"); var executor = MockRepository.GenerateStub<IPowershellExecutor>(); var messageHandler = new SowMessageHandler(executor); Assert.That(() => messageHandler.HandleMessage(message), Throws.ArgumentException); }
public void HandleMessage_VirtualMachineExists_PowershellIsInvokedOnce() { var message = new BrokeredMessage(); message.SetMessageType("Create"); 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.Once(); var messageHandler = new SowMessageHandler(executor); messageHandler.HandleMessage(message); executor.VerifyAllExpectations(); }