mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
This PR introduces a new built-in extension for Remote Desktop users. It allows you to view past RDP connections, save predefined connections, and connect to any of them. Or start a new RDP connection. https://github.com/user-attachments/assets/6a5041a6-5741-4df0-a305-da7166f962e1 ### GitHub issue maintenance stuff Closes #38305 --------- Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Jiří Polášek <me@jiripolasek.com>
102 lines
2.5 KiB
C#
102 lines
2.5 KiB
C#
// Copyright (c) Microsoft Corporation
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System.Linq;
|
|
using Microsoft.CmdPal.Ext.RemoteDesktop.Commands;
|
|
using Microsoft.CmdPal.Ext.RemoteDesktop.Pages;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace Microsoft.CmdPal.Ext.RemoteDesktop.UnitTests;
|
|
|
|
[TestClass]
|
|
public class RemoteDesktopCommandProviderTests
|
|
{
|
|
[TestMethod]
|
|
public void ProviderHasCorrectId()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Assert
|
|
Assert.AreEqual("com.microsoft.cmdpal.builtin.remotedesktop", provider.Id);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProviderHasDisplayName()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Assert
|
|
Assert.IsNotNull(provider.DisplayName);
|
|
Assert.IsTrue(provider.DisplayName.Length > 0);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ProviderHasIcon()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Assert
|
|
Assert.IsNotNull(provider.Icon);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TopLevelCommandsNotEmpty()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Act
|
|
var commands = provider.TopLevelCommands();
|
|
|
|
// Assert
|
|
Assert.IsNotNull(commands);
|
|
Assert.IsTrue(commands.Length > 0);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void FallbackCommandsNotEmpty()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Act
|
|
var commands = provider.FallbackCommands();
|
|
|
|
// Assert
|
|
Assert.IsNotNull(commands);
|
|
Assert.IsTrue(commands.Length > 0);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TopLevelCommandsContainListPageCommand()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Act
|
|
var commands = provider.TopLevelCommands();
|
|
|
|
// Assert
|
|
Assert.AreEqual(1, commands.Length);
|
|
Assert.IsInstanceOfType(commands.Single().Command, typeof(RemoteDesktopListPage));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void FallbackCommandsContainFallbackItem()
|
|
{
|
|
// Setup
|
|
var provider = new RemoteDesktopCommandProvider();
|
|
|
|
// Act
|
|
var commands = provider.FallbackCommands();
|
|
|
|
// Assert
|
|
Assert.AreEqual(1, commands.Length);
|
|
Assert.IsInstanceOfType(commands.Single(), typeof(FallbackRemoteDesktopItem));
|
|
}
|
|
}
|