public void GetIPForwardingOnRoleSucceeds() { // Setup cmdlet = new GetAzureIPForwarding { ServiceName = ServiceName, RoleName = RoleName, CommandRuntime = mockCommandRuntime, Client = this.client }; cmdlet.SetParameterSet(GetAzureIPForwarding.SlotIPForwardingParamSet); // Action cmdlet.ExecuteCmdlet(); // Assert computeClientMock.Verify( c => c.Deployments.GetBySlotAsync( ServiceName, DeploymentSlot.Production, It.IsAny<CancellationToken>()), Times.Once()); networkingClientMock.Verify( c => c.IPForwarding.GetForRoleAsync( cmdlet.ServiceName, DeploymentName, cmdlet.RoleName, It.IsAny<CancellationToken>()), Times.Once()); Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count); Assert.Equal("Enabled", mockCommandRuntime.OutputPipeline[0]); }
public void GetIPForwardingOnVMNicSucceeds() { // Setup var VM = new PersistentVMRoleContext() { // these are the only 2 properties being used in the cmdlet Name = RoleName, DeploymentName = DeploymentName }; cmdlet = new GetAzureIPForwarding { ServiceName = ServiceName, VM = VM, NetworkInterfaceName = NetworkInterfaceName, CommandRuntime = mockCommandRuntime, Client = this.client, }; cmdlet.SetParameterSet(GetAzureIPForwarding.IaaSIPForwardingParamSet); // Action cmdlet.ExecuteCmdlet(); // Assert computeClientMock.Verify( c => c.Deployments.GetBySlotAsync( ServiceName, DeploymentSlot.Production, It.IsAny<CancellationToken>()), Times.Never()); networkingClientMock.Verify( c => c.IPForwarding.GetForNetworkInterfaceAsync( cmdlet.ServiceName, DeploymentName, VM.Name, cmdlet.NetworkInterfaceName, It.IsAny<CancellationToken>()), Times.Once()); Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count); Assert.Equal("Disabled", mockCommandRuntime.OutputPipeline[0]); }