Inheritance: ICommandRuntime
 public void TestSetup()
 {
     mockCommandRuntime = new MockCommandRuntime();
     cmdlet = new AddAzureTrafficManagerEndpoint();
     cmdlet.CommandRuntime = mockCommandRuntime;
     clientMock = new Mock<TrafficManagerClient>();
 }
        public void NewAzureDedicatedCircuitSuccessful()
        {
            // Setup

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

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

            DedicatedCircuitGetResponse expected =
                new DedicatedCircuitGetResponse()
                {
                    DedicatedCircuit = new AzureDedicatedCircuit()
                    {
                        CircuitName = circuitName,
                        Bandwidth = bandwidth,
                        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.NewAsync(It.Is<DedicatedCircuitNewParameters>(x => x.Bandwidth == bandwidth && x.CircuitName == circuitName && x.Location == location && x.ServiceProviderName == serviceProviderName), It.IsAny<CancellationToken>())).Returns((DedicatedCircuitNewParameters param, CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuit).Returns(dcMock.Object);

            NewAzureDedicatedCircuitCommand cmdlet = new NewAzureDedicatedCircuitCommand()
            {
                CircuitName = circuitName,
                Bandwidth = bandwidth,
                Location = location,
                ServiceProviderName = serviceProviderName,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            AzureDedicatedCircuit actual = mockCommandRuntime.OutputPipeline[0] as AzureDedicatedCircuit;
            Assert.AreEqual<string>(expected.DedicatedCircuit.CircuitName, actual.CircuitName);
            Assert.AreEqual<uint>(expected.DedicatedCircuit.Bandwidth, actual.Bandwidth);
            Assert.AreEqual<string>(expected.DedicatedCircuit.Location, actual.Location);
            Assert.AreEqual<string>(expected.DedicatedCircuit.ServiceProviderName, actual.ServiceProviderName);
            Assert.AreEqual(expected.DedicatedCircuit.ServiceProviderProvisioningState, actual.ServiceProviderProvisioningState);
            Assert.AreEqual(expected.DedicatedCircuit.Status, actual.Status);
            Assert.AreEqual<string>(expected.DedicatedCircuit.ServiceKey, actual.ServiceKey);
        }
 public void SetupTest()
 {
     this.mockAutomationClient = new Mock<IAutomationClient>();
     this.mockCommandRuntime = new MockCommandRuntime();
     this.cmdlet = new RegisterAzureAutomationScheduledRunbook
     {
         AutomationClient = this.mockAutomationClient.Object,
         CommandRuntime = this.mockCommandRuntime
     };
 }
示例#4
0
 public void SetupTest()
 {
     this.mockAutomationClient = new Mock<IAutomationClient>();
     this.mockCommandRuntime = new MockCommandRuntime();
     this.cmdlet = new ResumeAzureAutomationJob
                       {
                           AutomationClient = this.mockAutomationClient.Object,
                           CommandRuntime = this.mockCommandRuntime
                       };
 }
 public void SetupTest()
 {
     this.mockAutomationClient = new Mock<IAutomationClient>();
     this.mockCommandRuntime = new MockCommandRuntime();
     this.cmdlet = new SetAzureAutomationRunbookDefinition
                       {
                           AutomationClient = this.mockAutomationClient.Object,
                           CommandRuntime = this.mockCommandRuntime
                       };
 }
        public void TestSetup()
        {
            mockCommandRuntime = new MockCommandRuntime();
            clientMock = new Mock<ITrafficManagerClient>();

            clientMock
                .Setup(c => c.InstantiateTrafficManagerDefinition(
                    It.IsAny<string>(),
                    It.IsAny<int>(),
                    It.IsAny<string>(),
                    It.IsAny<string>(),
                    It.IsAny<int>(),
                    It.IsAny<IList<TrafficManagerEndpoint>>()))
                .Returns(DefaultDefinition);
        }
        public void NewAzureDedicatedCircuitLinkSuccessful()
        {
            // Setup

            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            string vNetName = "DedicatedCircuitNetwork";

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dclMock = new Mock<IDedicatedCircuitLinkOperations>();

            DedicatedCircuitLinkGetResponse expected =
                new DedicatedCircuitLinkGetResponse()
                {
                    DedicatedCircuitLink = new AzureDedicatedCircuitLink()
                    {
                        VnetName = vNetName,
                        State = DedicatedCircuitLinkState.Provisioned
                    },
                    RequestId = "",               
                    StatusCode = new HttpStatusCode()
                };
            var t = new Task<DedicatedCircuitLinkGetResponse>(() => expected);
            t.Start();

            dclMock.Setup(f => f.NewAsync(It.Is<string>(x => x == serviceKey), It.Is<string>(y => y == vNetName), It.IsAny<CancellationToken>())).Returns((string sKey, string vNet, CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuitLink).Returns(dclMock.Object);

            NewAzureDedicatedCircuitLinkCommand cmdlet = new NewAzureDedicatedCircuitLinkCommand()
            {
                ServiceKey = serviceKey,
                VNetName = vNetName,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            AzureDedicatedCircuitLink actual = mockCommandRuntime.OutputPipeline[0] as AzureDedicatedCircuitLink;
            Assert.AreEqual<string>(expected.DedicatedCircuitLink.VnetName, actual.VnetName);
            Assert.AreEqual(expected.DedicatedCircuitLink.State.ToString(), actual.State.ToString());
        }
 public void TestSetup()
 {
     mockCommandRuntime = new MockCommandRuntime();
     clientMock = new Mock<ITrafficManagerClient>();
 }
 public void SetupTest()
 {
     mockCommandRuntime = new MockCommandRuntime();
     mockIPersistentVM = new MockIPersistentVMForChefExtension();
 }
        public void RemoveAzureBgpPeeringSuccessful()
        {
            // Setup

            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            BgpPeeringAccessType accessType = BgpPeeringAccessType.Private;

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var bgpMock = new Mock<IBorderGatewayProtocolPeeringOperations>();

            ExpressRouteOperationStatusResponse expected =
                new ExpressRouteOperationStatusResponse()
                {
                    Status = ExpressRouteOperationStatus.Successful,
                    HttpStatusCode = HttpStatusCode.OK
                };

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

            bgpMock.Setup(f => f.RemoveAsync(It.Is<string>(sKey => sKey == serviceKey), It.Is<BgpPeeringAccessType>(
                y => y == accessType),
                It.IsAny<CancellationToken>()))
                .Returns((string sKey, BgpPeeringAccessType aType, CancellationToken cancellation) => t);
            client.SetupGet(f => f.BorderGatewayProtocolPeerings).Returns(bgpMock.Object);

            RemoveAzureBGPPeeringCommand cmdlet = new RemoveAzureBGPPeeringCommand()
            {
                ServiceKey = serviceKey,
                AccessType = accessType,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            Assert.IsTrue(mockCommandRuntime.VerboseStream[0].Contains(serviceKey));
        }
 public void InitMock()
 {
     tableMock = new MockStorageTableManagement();
     MockCmdRunTime = new MockCommandRuntime();
 }
 public void TestSetup()
 {
     mockCommandRuntime = new MockCommandRuntime();
 }
        public void ListAzureDedicatedCircuitSuccessful()
        {
            // Setup

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

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

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

            List<AzureDedicatedCircuit> dedicatedCircuits = new List<AzureDedicatedCircuit>(){ 
                new AzureDedicatedCircuit(){ Bandwidth = bandwidth1, CircuitName = circuitName1, ServiceKey = serviceKey1, Location = location1, ServiceProviderName = serviceProviderName1, ServiceProviderProvisioningState = ProviderProvisioningState.NotProvisioned, Status = DedicatedCircuitState.Enabled}, 
                new AzureDedicatedCircuit(){ Bandwidth = bandwidth2, 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.DedicatedCircuit).Returns(dcMock.Object);

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

            cmdlet.ExecuteCmdlet();

            // Assert
            IEnumerable<AzureDedicatedCircuit> actual =
                mockCommandRuntime.OutputPipeline[0] as IEnumerable<AzureDedicatedCircuit>;
            Assert.AreEqual(actual.ToArray().Count(), 2);
        }
        public void ListAzureDedicatedCircuitServiceProviderSuccessful()
        {
            // Setup

            var serviceProviderName = "TestServiceProvider1";
            var serviceProviderName2 = "TestServiceProvier2";
            var type1 = "IXP";
            var type2 = "Telco";
           
            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dcsMock = new Mock<IDedicatedCircuitServiceProviderOperations>();

            List<AzureDedicatedCircuitServiceProvider>
                dedicatedCircuitServiceProviders = new List
                    <AzureDedicatedCircuitServiceProvider>()
                {
                    new AzureDedicatedCircuitServiceProvider()
                    {
                        DedicatedCircuitBandwidths =
                            new DedicatedCircuitBandwidth[1]
                            {
                                new DedicatedCircuitBandwidth()
                                {
                                    Bandwidth = 10,
                                    Label = "T1"
                                }
                            },
                        DedicatedCircuitLocations = "us-west",
                        Name = serviceProviderName,
                        Type = type1
                    },
                    new AzureDedicatedCircuitServiceProvider()
                    {
                        DedicatedCircuitBandwidths =
                            new DedicatedCircuitBandwidth[1]
                            {
                                new DedicatedCircuitBandwidth()
                                {
                                    Bandwidth = 10,
                                    Label = "T1"
                                }
                            },
                        DedicatedCircuitLocations = "us-west",
                        Name = serviceProviderName2,
                        Type = type2
                    }
                };
            DedicatedCircuitServiceProviderListResponse expected =
                new DedicatedCircuitServiceProviderListResponse()
                {
                    DedicatedCircuitServiceProviders = dedicatedCircuitServiceProviders,
                    StatusCode = HttpStatusCode.OK
                };

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

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

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

            cmdlet.ExecuteCmdlet();

            // Assert
            IEnumerable<AzureDedicatedCircuitServiceProvider> actual =
                mockCommandRuntime.OutputPipeline[0] as IEnumerable<AzureDedicatedCircuitServiceProvider>;
            Assert.AreEqual(actual.ToArray().Count(), 2);
        }
        public void NewAzureBgpPeeringSuccessful()
        {
            // Setup

            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            UInt32 peerAsn = 64496;
            string primaryPeerSubnet = "aaa";
            string secondayPeerSubnet = "bbb";
            UInt32 azureAsn = 64494;
            string primaryAzurePort = "8081";
            string secondaryAzurePort = "8082";
            var state = BgpPeeringState.Enabled;
            uint vlanId = 2;
            var accessType = BgpPeeringAccessType.Private;

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var bgpMock = new Mock<IBorderGatewayProtocolPeeringOperations>();
          
            BorderGatewayProtocolPeeringGetResponse expected =
                new BorderGatewayProtocolPeeringGetResponse
                {
                    BgpPeering = new AzureBgpPeering()
                    {
                        AzureAutonomousSystemNumber = azureAsn,
                        PeerAutonomousSystemNumber = peerAsn,
                        PrimaryAzurePort = primaryAzurePort,
                        PrimaryPeerSubnet = primaryPeerSubnet,   
                        SecondaryAzurePort = secondaryAzurePort,
                        SecondaryPeerSubnet = secondayPeerSubnet,
                        State = state,         
                        VirtualLanId = vlanId
                    },
                    RequestId = "",
                    StatusCode = new HttpStatusCode()
                };
            var t = new Task<BorderGatewayProtocolPeeringGetResponse>(() => expected);
            t.Start();
            
            bgpMock.Setup(
                f =>
                    f.NewAsync(It.Is<string>(x => x == serviceKey),
                        It.Is<BgpPeeringAccessType>(
                            y => y == accessType),
                        It.Is<BorderGatewayProtocolPeeringNewParameters>(
                            z =>
                                z.PeerAutonomousSystemNumber == peerAsn && z.PrimaryPeerSubnet == primaryPeerSubnet &&
                                z.SecondaryPeerSubnet == secondayPeerSubnet && z.VirtualLanId == vlanId),
                        It.IsAny<CancellationToken>()))
                .Returns((string sKey, BgpPeeringAccessType atype, BorderGatewayProtocolPeeringNewParameters param, CancellationToken cancellation) => t);
            client.SetupGet(f => f.BorderGatewayProtocolPeerings).Returns(bgpMock.Object);

            NewAzureBGPPeeringCommand cmdlet = new NewAzureBGPPeeringCommand()
            {
                ServiceKey = serviceKey,
                AccessType = accessType,
                PeerAsn = peerAsn,
                PrimaryPeerSubnet = primaryPeerSubnet,
                SecondaryPeerSubnet = secondayPeerSubnet,
                SharedKey = null,
                VlanId = vlanId,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            AzureBgpPeering actual = mockCommandRuntime.OutputPipeline[0] as AzureBgpPeering;
            Assert.AreEqual(expected.BgpPeering.State, actual.State);
            Assert.AreEqual(expected.BgpPeering.PrimaryAzurePort, actual.PrimaryAzurePort);
        }
        public void RemoveAzureDedicatedCircuitSuccessful()
        {
            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            string vNetName = "DedicatedCircuitNetwork";
            ExpressRouteOperationStatusResponse expected =
                new ExpressRouteOperationStatusResponse()
                {
                    Status = ExpressRouteOperationStatus.Successful,
                    HttpStatusCode = HttpStatusCode.OK
                };

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dclMock = new Mock<IDedicatedCircuitLinkOperations>();

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

            dclMock.Setup(f => f.RemoveAsync(It.Is<string>(sKey => sKey == serviceKey), It.Is<string>(vnet => vnet == vNetName), It.IsAny<CancellationToken>())).Returns((string sKey, string vnet, CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuitLink).Returns(dclMock.Object);

            RemoveAzureDedicatedCircuitLinkCommand cmdlet = new RemoveAzureDedicatedCircuitLinkCommand()
            {
                ServiceKey = serviceKey,
                VNetName = vNetName,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            Assert.IsTrue(mockCommandRuntime.VerboseStream[0].Contains(serviceKey));
        }
        public void ListAzureDedicatedCircuitLinkSuccessful()
        {
            // Setup

            
            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";

            string vnet1 = "DedicatedCircuitNetwork";
            string vnet2 = "AzureNetwork";

            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var dclMock = new Mock<IDedicatedCircuitLinkOperations>();

            List<AzureDedicatedCircuitLink> dedicatedCircuitLinks = new List<AzureDedicatedCircuitLink>(){ 
                new AzureDedicatedCircuitLink(){ VnetName = vnet1, State = DedicatedCircuitLinkState.Provisioned}, 
                new AzureDedicatedCircuitLink(){ VnetName = vnet2, State = DedicatedCircuitLinkState.NotProvisioned}};

            DedicatedCircuitLinkListResponse expected =
                new DedicatedCircuitLinkListResponse()
                {
                    DedicatedCircuitLinks = dedicatedCircuitLinks,
                    StatusCode = HttpStatusCode.OK
                };

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

            dclMock.Setup(f => f.ListAsync(It.Is<string>(skey => skey == serviceKey), It.IsAny<CancellationToken>())).Returns((string skey, CancellationToken cancellation) => t);
            client.SetupGet(f => f.DedicatedCircuitLink).Returns(dclMock.Object);

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

            cmdlet.ExecuteCmdlet();

            // Assert
            IEnumerable<AzureDedicatedCircuitLink> actual =
                mockCommandRuntime.OutputPipeline[0] as IEnumerable<AzureDedicatedCircuitLink>;
            Assert.AreEqual(actual.ToArray().Count(), 2);
        }
 public void InitMock()
 {
     BlobMock = new MockStorageBlobManagement();
     MockCmdRunTime = new MockCommandRuntime();
 }
 public void InitMock()
 {
     queueMock = new MockStorageQueueManagement();
     MockCmdRunTime = new MockCommandRuntime();
 }
        public void SetBgpPeeringSuccessful()
        {
            // Setup

            string serviceKey = "aa28cd19-b10a-41ff-981b-53c6bbf15ead";
            UInt32 peerAsn = 64496;
            string primaryPeerSubnet = "aaa";
            string newPrimaryPeerSubnet = "ccc";
            string secondayPeerSubnet = "bbb";
            UInt32 azureAsn = 64494;
            string primaryAzurePort = "8081";
            string secondaryAzurePort = "8082";
            BGPPeeringState state = BGPPeeringState.Enabled;
            uint vlanId = 2;
            BgpPeeringAccessType accessType = BgpPeeringAccessType.Private;
            
            MockCommandRuntime mockCommandRuntime = new MockCommandRuntime();
            Mock<ExpressRouteManagementClient> client = InitExpressRouteManagementClient();
            var bgpMock = new Mock<IBgpPeeringOperations>();

            BgpPeeringGetResponse expected =
                new BgpPeeringGetResponse()
                {
                    BgpPeering = new AzureBgpPeering()
                    {
                        AzureAsn = azureAsn,
                        PeerAsn = peerAsn,
                        PrimaryAzurePort = primaryAzurePort,
                        PrimaryPeerSubnet = primaryPeerSubnet,
                        SecondaryAzurePort = secondaryAzurePort,
                        SecondaryPeerSubnet = secondayPeerSubnet,
                        State = state,
                        VlanId = vlanId
                    },
                    RequestId = "",
                    StatusCode = new HttpStatusCode()
                };
            var t = new Task<BgpPeeringGetResponse>(() => expected);
            t.Start();

            BgpPeeringGetResponse expected2 =
               new BgpPeeringGetResponse()
               {
                   BgpPeering = new AzureBgpPeering()
                   {
                       AzureAsn = azureAsn,
                       PeerAsn = peerAsn,
                       PrimaryAzurePort = primaryAzurePort,
                       PrimaryPeerSubnet = newPrimaryPeerSubnet,
                       SecondaryAzurePort = secondaryAzurePort,
                       SecondaryPeerSubnet = secondayPeerSubnet,
                       State = state,
                       VlanId = vlanId
                   },
                   RequestId = "",
                   StatusCode = new HttpStatusCode()
               };
            var t2 = new Task<BgpPeeringGetResponse>(() => expected2);
            t2.Start();

            bgpMock.Setup(
                f =>
                    f.GetAsync(It.Is<string>(x => x == serviceKey),
                        It.Is<BgpPeeringAccessType>(
                            y => y == accessType),
                        It.IsAny<CancellationToken>()))
                        .Returns((string sKey, BgpPeeringAccessType atype, CancellationToken cancellation) => t);

            bgpMock.Setup(
                f =>
                    f.UpdateAsync(It.Is<string>(x => x == serviceKey),
                        It.Is<BgpPeeringAccessType>(
                            y => y == accessType),
                        It.Is<BgpPeeringUpdateParameters>(z => z.PrimaryPeerSubnet == newPrimaryPeerSubnet),
                        It.IsAny<CancellationToken>()))
                        .Returns((string sKey, BgpPeeringAccessType atype, BgpPeeringUpdateParameters param, CancellationToken cancellation) => t2);
            client.SetupGet(f => f.BgpPeering).Returns(bgpMock.Object);

            SetAzureBGPPeeringCommand cmdlet = new SetAzureBGPPeeringCommand()
            {
                ServiceKey = serviceKey,
                AccessType = accessType,
                PrimaryPeerSubnet = newPrimaryPeerSubnet,
                CommandRuntime = mockCommandRuntime,
                ExpressRouteClient = new ExpressRouteClient(client.Object)
            };

            cmdlet.ExecuteCmdlet();

            // Assert
            AzureBgpPeering actual = mockCommandRuntime.OutputPipeline[0] as AzureBgpPeering;
            Assert.AreEqual<string>(expected2.BgpPeering.PrimaryPeerSubnet, actual.PrimaryPeerSubnet);
            Assert.AreEqual(expected.BgpPeering.PrimaryAzurePort, actual.PrimaryAzurePort);
        }