public void GetAzureDedicatedCircuitSuccessful()
        {
            // Setup

            string circuitName = "TestCircuit";
            uint bandwidth = 10;
            string serviceProviderName = "TestProvider";
            string location = "us-west";
            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            BillingType billingType = BillingType.MeteredData;

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dcMock = new Mock<IDedicatedCircuitOperations>();

            DedicatedCircuitGetResponse expected =
                new DedicatedCircuitGetResponse()
                {
                    DedicatedCircuit = new AzureDedicatedCircuit()
                    {
                        CircuitName = circuitName,
                        Bandwidth = bandwidth,
                        BillingType = billingType.ToString(),
                        Location = location,
                        ServiceProviderName = serviceProviderName,
                        ServiceKey = serviceKey,
                        ServiceProviderProvisioningState = ProviderProvisioningState.NotProvisioned,
                        Status = DedicatedCircuitState.Enabled,
                    },
                    RequestId = "",
                    StatusCode = new HttpStatusCode()
                };
            var t = new Task<DedicatedCircuitGetResponse>(() => expected);
            t.Start();

            dcMock.Setup(f => f.GetAsync(It.Is<string>(sKey => sKey == serviceKey), It.IsAny<CancellationToken>())).Returns((string sKey, CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuits).Returns(dcMock.Object);

            GetAzureDedicatedCircuitCommand cmdlet = new GetAzureDedicatedCircuitCommand()
            {
                ServiceKey = Guid.Parse(serviceKey),
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            AzureDedicatedCircuit actual = mockCommandRuntime.OutputPipeline[0] as AzureDedicatedCircuit;
            Assert.Equal<string>(expected.DedicatedCircuit.BillingType, actual.BillingType);
            Assert.Equal<string>(expected.DedicatedCircuit.CircuitName, actual.CircuitName);
            Assert.Equal<uint>(expected.DedicatedCircuit.Bandwidth, actual.Bandwidth);
            Assert.Equal<string>(expected.DedicatedCircuit.Location, actual.Location);
            Assert.Equal<string>(expected.DedicatedCircuit.ServiceProviderName, actual.ServiceProviderName);
            Assert.Equal(expected.DedicatedCircuit.ServiceProviderProvisioningState, actual.ServiceProviderProvisioningState);
            Assert.Equal(expected.DedicatedCircuit.Status, actual.Status);
            Assert.Equal<string>(expected.DedicatedCircuit.ServiceKey, actual.ServiceKey);
        }
        public void ListAzureDedicatedCircuitSuccessful()
        {
            // Setup

            string circuitName1 = "TestCircuit";
            uint bandwidth1 = 10;
            string serviceProviderName1 = "TestProvider";
            string location1 = "us-west";
            string serviceKey1 = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            BillingType billingType1 = BillingType.MeteredData;

            string circuitName2 = "TestCircuit2";
            uint bandwidth2 = 10;
            string serviceProviderName2 = "TestProvider";
            string location2 = "us-north";
            string serviceKey2 = "bc28cd19-b10a-41ff-981b-53c6bbf15ead";
            BillingType billingType2 = BillingType.UnlimitedData;

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dcMock = new Mock<IDedicatedCircuitOperations>();

            List<AzureDedicatedCircuit> dedicatedCircuits = new List<AzureDedicatedCircuit>(){
                new AzureDedicatedCircuit(){ Bandwidth = bandwidth1, BillingType = billingType1.ToString(), CircuitName = circuitName1, ServiceKey = serviceKey1, Location = location1, ServiceProviderName = serviceProviderName1, ServiceProviderProvisioningState = ProviderProvisioningState.NotProvisioned, Status = DedicatedCircuitState.Enabled},
                new AzureDedicatedCircuit(){ Bandwidth = bandwidth2, BillingType = billingType2.ToString(), CircuitName = circuitName2, ServiceKey = serviceKey2, Location = location2, ServiceProviderName = serviceProviderName2, ServiceProviderProvisioningState = ProviderProvisioningState.Provisioned, Status = DedicatedCircuitState.Enabled}
            };

            DedicatedCircuitListResponse expected =
                new DedicatedCircuitListResponse()
                {
                    DedicatedCircuits = dedicatedCircuits,
                    StatusCode = HttpStatusCode.OK
                };

            var t = new Task<DedicatedCircuitListResponse>(() => expected);
            t.Start();

            dcMock.Setup(f => f.ListAsync(It.IsAny<CancellationToken>())).Returns((CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuits).Returns(dcMock.Object);

             GetAzureDedicatedCircuitCommand cmdlet = new GetAzureDedicatedCircuitCommand()
            {
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            IEnumerable<AzureDedicatedCircuit> actual = LanguagePrimitives.GetEnumerable(mockCommandRuntime.OutputPipeline).Cast<AzureDedicatedCircuit>();

            Assert.Equal(actual.Count(), 2);
        }