public void NewAzureReservedIPSimple() { NewAzureReservedIPCmdlet cmdlet = new NewAzureReservedIPCmdlet(testClientProvider) { ReservedIPName = ReservedIPName, Location = "WestUS", Label = ReservedIPLabel, CommandRuntime = mockCommandRuntime, }; cmdlet.SetParameterSet(NewAzureReservedIPCmdlet.ReserveNewIPParamSet); // Action cmdlet.ExecuteCmdlet(); // Assert computeClientMock.Verify( c => c.Deployments.GetBySlotAsync( ServiceName, DeploymentSlot.Production, It.IsAny <CancellationToken>()), Times.Never); networkingClientMock.Verify( c => c.ReservedIPs.CreateAsync( It.Is <NetworkReservedIPCreateParameters>( p => string.Equals(p.Name, ReservedIPName) && string.IsNullOrEmpty(p.ServiceName) && string.IsNullOrEmpty(p.VirtualIPName) && string.IsNullOrEmpty(p.DeploymentName)), It.IsAny <CancellationToken>()), Times.Once()); Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count); Assert.Equal("Succeeded", ((ManagementOperationContext)mockCommandRuntime.OutputPipeline[0]).OperationStatus); }
public void NewAzureReservedIPWithIPTags() { IPTag iptag = new IPTag(); iptag.IPTagType = "FirstPartyUsage"; iptag.Value = "InfrastructureTenants"; List <IPTag> iptags = new List <IPTag>(); iptags.Add(iptag); NewAzureReservedIPCmdlet cmdlet = new NewAzureReservedIPCmdlet(testClientProvider) { ReservedIPName = ReservedIPName, Location = "WestUS", Label = ReservedIPLabel, CommandRuntime = mockCommandRuntime, IPTagList = iptags }; cmdlet.SetParameterSet(NewAzureReservedIPCmdlet.ReserveNewIPParamSet); // Action cmdlet.ExecuteCmdlet(); networkingClientMock.Verify( c => c.ReservedIPs.CreateAsync( It.Is <NetworkReservedIPCreateParameters>( p => string.Equals(p.Name, ReservedIPName) && string.IsNullOrEmpty(p.ServiceName) && string.IsNullOrEmpty(p.VirtualIPName) && string.IsNullOrEmpty(p.DeploymentName) && p.IPTags == iptags), It.IsAny <CancellationToken>()), Times.Once()); Assert.Equal("Succeeded", ((ManagementOperationContext)mockCommandRuntime.OutputPipeline[0]).OperationStatus); }