Exemple #1
0
        public void WhenSetValidVmInstanceSettings_GetVmInstanceSettingsReturnSameValues()
        {
            var baseKey    = hkcu.CreateSubKey(TestKeyPath);
            var repository = new InventorySettingsRepository(baseKey);

            repository.SetProjectSettings(new ProjectSettings()
            {
                ProjectId = "pro-1"
            });
            repository.SetVmInstanceSettings("pro-1", new VmInstanceSettings()
            {
                InstanceName        = "vm-1",
                Username            = "******",
                ConnectionBar       = RdpConnectionBarState.Pinned,
                DesktopSize         = RdpDesktopSize.ScreenSize,
                AuthenticationLevel = RdpAuthenticationLevel.RequireServerAuthentication,
                ColorDepth          = RdpColorDepth.DeepColor,
                AudioMode           = RdpAudioMode.DoNotPlay,
                RedirectClipboard   = RdpRedirectClipboard.Enabled
            });

            var settings = repository.GetVmInstanceSettings("pro-1", "vm-1");

            Assert.AreEqual("user-1", settings.Username);
            Assert.AreEqual(RdpConnectionBarState.Pinned, settings.ConnectionBar);
            Assert.AreEqual(RdpDesktopSize.ScreenSize, settings.DesktopSize);
            Assert.AreEqual(RdpAuthenticationLevel.RequireServerAuthentication, settings.AuthenticationLevel);
            Assert.AreEqual(RdpColorDepth.DeepColor, settings.ColorDepth);
            Assert.AreEqual(RdpAudioMode.DoNotPlay, settings.AudioMode);
            Assert.AreEqual(RdpRedirectClipboard.Enabled, settings.RedirectClipboard);
        }
Exemple #2
0
        public void WhenProjectSettingsDeleted_VmInstanceSettingsAreDeletedToo()
        {
            var baseKey    = hkcu.CreateSubKey(TestKeyPath);
            var repository = new InventorySettingsRepository(baseKey);

            repository.SetProjectSettings(new ProjectSettings()
            {
                ProjectId = "pro-1"
            });
            repository.SetVmInstanceSettings("pro-1", new VmInstanceSettings()
            {
                InstanceName = "vm-1",
                Username     = "******"
            });
            repository.DeleteProjectSettings("pro-1");

            Assert.Throws <KeyNotFoundException>(() =>
            {
                repository.GetVmInstanceSettings("pro-1", "vm-1");
            });
        }