public static int SetUpDefaultVpnDevice(Mock <IRemoteAppManagementClient> clientMock, string name) { ISetup <IRemoteAppManagementClient, Task <VNetVpnDeviceResult> > setup = null; VNetVpnDeviceResult response = new VNetVpnDeviceResult() { RequestId = "23411-345", StatusCode = System.Net.HttpStatusCode.OK, Vendors = new Vendor[] { new Vendor() { Name = "Acme", Platforms = new List <Platform>() { new Platform() { Name = "BasicVPN", OsFamilies = new List <OsFamily>() } } } } }; mockVpnList = new List <Vendor>(response.Vendors); setup = clientMock.Setup(c => c.VNet.GetVpnDevicesAsync(name, It.IsAny <CancellationToken>())); setup.Returns(Task.Factory.StartNew(() => response)); return(mockVpnList.Count); }
public void CanGetVpnDevices() { using (UndoContext context = UndoContext.Current) { context.Start(); HttpRecorderMode mode = HttpMockServer.GetCurrentMode(); RemoteAppManagementClient remoteAppManagementClient = GetRemoteAppManagementClient(); Assert.DoesNotThrow(() => { string vNet = TestVnet; VNetVpnDeviceResult result = remoteAppManagementClient.VNet.GetVpnDevices(vNet); Assert.NotNull(result); Assert.Equal(HttpStatusCode.OK, result.StatusCode); ValidateVendors(result.Vendors); }); } }
public override void ExecuteCmdlet() { VNetVpnDeviceResult response = CallClient(() => Client.VNet.GetVpnDevices(VNetName), Client.VNet); WriteObject(response.Vendors, true); }