public void SetAzureStoreAddOnWithPassThru() { // Setup bool expected = true; string name = "TestAddOn"; string addonId = "Search"; string plan = "free"; string message = "Expected message for set"; cmdlet.Name = name; cmdlet.Plan = plan; cmdlet.PassThru = true; WindowsAzureAddOn addon = new WindowsAzureAddOn(new Resource() { Type = addonId }, "West US", null); mockConfirmation.Setup(f => f.ShouldProcess(Resources.SetAddOnConformation, message)).Returns(true); mockStoreClient.Setup(f => f.TryGetAddOn(name, out addon)).Returns(true); mockStoreClient.Setup(f => f.UpdateAddOn(name, plan, null)); mockStoreClient.Setup(f => f.GetConfirmationMessage(OperationType.Set, addonId, plan)).Returns(message); // Test cmdlet.ExecuteCmdlet(); // Assert mockStoreClient.Verify(f => f.UpdateAddOn(name, plan, null), Times.Once()); mockConfirmation.Verify(f => f.ShouldProcess(Resources.SetAddOnConformation, message), Times.Once()); mockCommandRuntime.Verify(f => f.WriteObject(expected), Times.Once()); }
public void RemoveAzureStoreAddOnWithSuccessful() { // Setup bool expected = true; string name = "TestAddOn"; string addonId = "Search"; string message = "Expected message for remove"; cmdlet.Name = name; WindowsAzureAddOn addon = new WindowsAzureAddOn(new Resource() { Type = addonId }, "West US", null); mockConfirmation.Setup(f => f.ShouldProcess(Resources.RemoveAddOnConformation, message)).Returns(true); mockStoreClient.Setup(f => f.RemoveAddOn(name)); mockStoreClient.Setup(f => f.GetConfirmationMessage(OperationType.Remove, null, null)).Returns(message); // Test cmdlet.ExecuteCmdlet(); // Assert mockStoreClient.Verify(f => f.RemoveAddOn(name), Times.Once()); mockConfirmation.Verify(f => f.ShouldProcess(Resources.RemoveAddOnConformation, message), Times.Once()); mockCommandRuntime.Verify(f => f.WriteObject(expected), Times.Never()); }