public void WhenDesktopSizeSetInProject_ProjectValueIsInheritedDownToVm( [Values(RdpDesktopSize.ClientSize, RdpDesktopSize.ScreenSize)] RdpDesktopSize size ) { this.projectNode.DesktopSize = size; var zoneA = (ZoneNode)this.projectNode.FirstNode; var zoneB = (ZoneNode)this.projectNode.FirstNode.NextNode; Assert.AreEqual(size, zoneA.DesktopSize); Assert.AreEqual(size, zoneB.DesktopSize); var instanceA = (VmInstanceNode)zoneA.FirstNode; var instanceB = (VmInstanceNode)zoneB.FirstNode; Assert.AreEqual(size, instanceA.DesktopSize); Assert.AreEqual(size, instanceB.DesktopSize); Assert.AreEqual(size, instanceA.EffectiveSettingsWithInheritanceApplied.DesktopSize); Assert.AreEqual(size, instanceB.EffectiveSettingsWithInheritanceApplied.DesktopSize); Assert.IsFalse(instanceA.ShouldSerializeDesktopSize()); Assert.IsFalse(instanceB.ShouldSerializeDesktopSize()); }
public async Task WhenCredentialsValid_ThenConnectingSucceeds( [Values(RdpConnectionBarState.AutoHide, RdpConnectionBarState.Off, RdpConnectionBarState.Pinned)] RdpConnectionBarState connectionBarState, [Values(RdpDesktopSize.ClientSize, RdpDesktopSize.ScreenSize)] RdpDesktopSize desktopSize, [Values(RdpAudioMode.DoNotPlay, RdpAudioMode.PlayLocally, RdpAudioMode.PlayOnServer)] RdpAudioMode audioMode, [Values(RdpRedirectClipboard.Disabled, RdpRedirectClipboard.Enabled)] RdpRedirectClipboard redirectClipboard, // Use a slightly larger machine type as all this RDP'ing consumes a fair // amount of memory. [WindowsInstance(MachineType = "n1-standard-2")] InstanceRequest testInstance) { await testInstance.AwaitReady(); using (var tunnel = RdpTunnel.Create(testInstance.InstanceReference)) using (var gceAdapter = new ComputeEngineAdapter(this.serviceProvider.GetService <IAuthorizationService>())) { var credentials = await gceAdapter.ResetWindowsUserAsync( testInstance.InstanceReference, "test", CancellationToken.None); var rdpService = new RemoteDesktopService(this.serviceProvider); var session = rdpService.Connect( testInstance.InstanceReference, "localhost", (ushort)tunnel.LocalPort, new VmInstanceSettings() { Username = credentials.UserName, Password = credentials.SecurePassword, ConnectionBar = connectionBarState, DesktopSize = desktopSize, AudioMode = audioMode, RedirectClipboard = redirectClipboard, AuthenticationLevel = RdpAuthenticationLevel.NoServerAuthentication, BitmapPersistence = RdpBitmapPersistence.Disabled }); AwaitEvent <RemoteDesktopConnectionSuceededEvent>(); Assert.IsNull(this.ExceptionShown); RemoteDesktopWindowClosedEvent expectedEvent = null; this.serviceProvider.GetService <IEventService>() .BindHandler <RemoteDesktopWindowClosedEvent>(e => { expectedEvent = e; }); session.Close(); Assert.IsNotNull(expectedEvent); } }
public void WhenDesktopSizeSetInProject_ProjectValueIsInheritedDownToVm( [Values(RdpDesktopSize.ClientSize, RdpDesktopSize.ScreenSize)] RdpDesktopSize size ) { this.project.DesktopSize = size; Assert.AreEqual(size, zoneA.DesktopSize); Assert.AreEqual(size, zoneB.DesktopSize); Assert.AreEqual(size, instanceA.DesktopSize); Assert.AreEqual(size, instanceB.DesktopSize); Assert.AreEqual(size, instanceA.CreateConnectionSettings("instance").DesktopSize); Assert.AreEqual(size, instanceB.CreateConnectionSettings("instance").DesktopSize); Assert.IsFalse(instanceA.ShouldSerializeDesktopSize()); Assert.IsFalse(instanceB.ShouldSerializeDesktopSize()); }
public async Task WhenCredentialsValid_ThenConnectingSucceeds( [Values(RdpConnectionBarState.AutoHide, RdpConnectionBarState.Off, RdpConnectionBarState.Pinned)] RdpConnectionBarState connectionBarState, [Values(RdpDesktopSize.ClientSize, RdpDesktopSize.ScreenSize)] RdpDesktopSize desktopSize, [Values(RdpAudioMode.DoNotPlay, RdpAudioMode.PlayLocally, RdpAudioMode.PlayOnServer)] RdpAudioMode audioMode, [Values(RdpRedirectClipboard.Disabled, RdpRedirectClipboard.Enabled)] RdpRedirectClipboard redirectClipboard, // Use a slightly larger machine type as all this RDP'ing consumes a fair // amount of memory. [WindowsInstance(MachineType = "n1-standard-2")] ResourceTask <InstanceLocator> testInstance, [Credential(Role = PredefinedRole.IapTunnelUser)] ResourceTask <ICredential> credential) { var locator = await testInstance; using (var tunnel = RdpTunnel.Create( locator, await credential)) using (var gceAdapter = new ComputeEngineAdapter(this.serviceProvider.GetService <IAuthorizationAdapter>())) { var credentials = await gceAdapter.ResetWindowsUserAsync( locator, CreateRandomUsername(), TimeSpan.FromSeconds(60), CancellationToken.None); var settings = VmInstanceConnectionSettings.CreateNew( locator.ProjectId, locator.Name); settings.Username.StringValue = credentials.UserName; settings.Password.Value = credentials.SecurePassword; settings.ConnectionBar.EnumValue = connectionBarState; settings.DesktopSize.EnumValue = desktopSize; settings.AudioMode.EnumValue = audioMode; settings.RedirectClipboard.EnumValue = redirectClipboard; settings.AuthenticationLevel.EnumValue = RdpAuthenticationLevel.NoServerAuthentication; settings.BitmapPersistence.EnumValue = RdpBitmapPersistence.Disabled; var rdpService = new RemoteDesktopConnectionBroker(this.serviceProvider); var session = rdpService.Connect( locator, "localhost", (ushort)tunnel.LocalPort, settings); AwaitEvent <ConnectionSuceededEvent>(); Assert.IsNull(this.ExceptionShown); ConnectionClosedEvent expectedEvent = null; this.serviceProvider.GetService <IEventService>() .BindHandler <ConnectionClosedEvent>(e => { expectedEvent = e; }); session.Close(); Assert.IsNotNull(expectedEvent); } }