public void CreateLabTest() { using (MockContext context = MockContext.Start(this.GetType())) { LabServicesClient client = GetManagedLabsClient(context); var lab = new Lab { Title = "test lab", Location = "westus", AutoShutdownProfile = new AutoShutdownProfile { ShutdownOnDisconnect = EnableState.Disabled, ShutdownOnIdle = ShutdownOnIdleMode.UserAbsence, ShutdownWhenNotConnected = EnableState.Disabled, IdleDelay = TimeSpan.FromMinutes(15) }, ConnectionProfile = new ConnectionProfile { ClientRdpAccess = ConnectionType.Public, ClientSshAccess = ConnectionType.Public, WebRdpAccess = ConnectionType.None, WebSshAccess = ConnectionType.None }, VirtualMachineProfile = new VirtualMachineProfile { CreateOption = CreateOption.TemplateVM, AdminUser = new Credentials { Username = "******", Password = "******", }, ImageReference = new ImageReference { Sku = "20_04-lts", Offer = "0001-com-ubuntu-server-focal", Publisher = "canonical", Version = "latest" }, Sku = new Sku { Name = "Standard_Fsv2_2_4GB_64_S_SSD", Capacity = 0 }, UsageQuota = TimeSpan.FromHours(2), UseSharedPassword = EnableState.Enabled }, SecurityProfile = new SecurityProfile(openAccess: EnableState.Disabled) }; var labResponse = client.Labs.BeginCreateOrUpdate(body: lab, resourceGroupName: rg, labName: labName); Assert.NotNull(labResponse); Assert.IsType <Lab>(labResponse); Assert.Equal(ProvisioningState.Creating, labResponse.ProvisioningState); } }
public void ListLabPlansTest() { using (MockContext context = MockContext.Start(this.GetType())) { LabServicesClient client = GetManagedLabsClient(context); var labPlans = client.LabPlans.ListBySubscription().ToList(); Assert.NotEmpty(labPlans); var labPlan = labPlans.First(); Assert.IsType <LabPlan>(labPlan); } }
public async void DeleteLabTest() { using (MockContext context = MockContext.Start(this.GetType())) { LabServicesClient client = GetManagedLabsClient(context); var deleteResponse = await client.Labs.BeginDeleteWithHttpMessagesAsync(resourceGroupName : rg, labName : labName); Assert.NotNull(deleteResponse); Assert.NotNull(deleteResponse.Response); Assert.True(deleteResponse.Response.IsSuccessStatusCode); } }
public void UpdateLabTest() { using (MockContext context = MockContext.Start(this.GetType())) { var newTitle = "new title"; LabServicesClient client = GetManagedLabsClient(context); var labUpdate = new LabUpdate { Title = newTitle }; var labResponse = client.Labs.Update(body: labUpdate, resourceGroupName: rg, labName: labName); Assert.NotNull(labResponse); Assert.IsType <Lab>(labResponse); Assert.Equal(newTitle, labResponse.Title); } }