public void GetNSGForVMNicDetails()
        {
            // Setup
            cmdlet = new GetAzureNetworkSecurityGroupAssociation
            {
                VM = VM,
                ServiceName = ServiceName,
                NetworkInterfaceName = NetworkInterfaceName,
                CommandRuntime = mockCommandRuntime,
                Detailed = new SwitchParameter(true),
                Client = this.client
            };
            cmdlet.SetParameterSet(GetAzureNetworkSecurityGroupAssociation.GetNetworkSecurityGroupAssociationForIaaSRole);

            // Action
            cmdlet.ExecuteCmdlet();

            networkingClientMock.Verify(
                c => c.NetworkSecurityGroups.GetForNetworkInterfaceAsync(
                    ServiceName,
                    DeploymentName,
                    RoleName,
                    NetworkInterfaceName,
                    It.IsAny<CancellationToken>()),
                Times.Once);

            networkingClientMock.Verify(
                c => c.NetworkSecurityGroups.GetAsync(
                    NetworkSecurityGroupName,
                    "Full",
                    It.IsAny<CancellationToken>()),
                Times.Once);

            Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count);
            Assert.IsType<NetworkSecurityGroupWithRules>(mockCommandRuntime.OutputPipeline.Single());
            var nsg = (NetworkSecurityGroupWithRules)(mockCommandRuntime.OutputPipeline.Single());
            Assert.Equal(NetworkSecurityGroupName, nsg.Name);
            Assert.Equal(NSGLabel, nsg.Label);
            Assert.Equal(NSGLocation, nsg.Location);
            Assert.NotEmpty(nsg.Rules);
            Assert.Equal(Rules.First().Name, nsg.Rules.First().Name);
            Assert.Equal(Rules.First().Action, nsg.Rules.First().Action);
            Assert.Equal(Rules.First().Protocol, nsg.Rules.First().Protocol);
        }
        public void GetNSGForVMNicNoDetails()
        {
            // Setup
            cmdlet = new GetAzureNetworkSecurityGroupAssociation
            {
                VM = VM,
                ServiceName = ServiceName,
                NetworkInterfaceName = NetworkInterfaceName,
                CommandRuntime = mockCommandRuntime,
                Client = this.client
            };
            cmdlet.SetParameterSet(GetAzureNetworkSecurityGroupAssociation.GetNetworkSecurityGroupAssociationForIaaSRole);

            // Action
            cmdlet.ExecuteCmdlet();

            networkingClientMock.Verify(
                c => c.NetworkSecurityGroups.GetForNetworkInterfaceAsync(
                    ServiceName,
                    DeploymentName,
                    RoleName,
                    NetworkInterfaceName,
                    It.IsAny<CancellationToken>()),
                Times.Once);

            networkingClientMock.Verify(
                c => c.NetworkSecurityGroups.GetAsync(
                    NetworkSecurityGroupName,
                    null,
                    It.IsAny<CancellationToken>()),
                Times.Once);

            Assert.Equal(1, mockCommandRuntime.OutputPipeline.Count);
            Assert.IsType<SimpleNetworkSecurityGroup>(mockCommandRuntime.OutputPipeline.Single());
            var nsg = (SimpleNetworkSecurityGroup)(mockCommandRuntime.OutputPipeline.Single());
            Assert.Equal(NetworkSecurityGroupName, nsg.Name);
            Assert.Equal(NSGLocation, nsg.Location);
            Assert.Equal(NSGLabel, nsg.Label);
        }