mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
- can edit items in listview - improved data binding between model and ui - delete and launch buttons disabled if no item selected - item selection updates when deleting/adding item
58 lines
1.6 KiB
C#
58 lines
1.6 KiB
C#
using System.Collections.ObjectModel;
|
|
using mRemoteNG.App;
|
|
using mRemoteNG.Connection;
|
|
using mRemoteNG.Connection.Protocol;
|
|
using mRemoteNG.Tools;
|
|
using mRemoteNG.Tools.CustomCollections;
|
|
using mRemoteNG.UI.Window;
|
|
using NUnit.Framework;
|
|
using WeifenLuo.WinFormsUI.Docking;
|
|
|
|
namespace mRemoteNGTests.Connection.Protocol
|
|
{
|
|
public class IntegratedProgramTests
|
|
{
|
|
private readonly ExternalTool _extTool = new ExternalTool
|
|
{
|
|
DisplayName = "notepad",
|
|
FileName = @"%windir%\system32\notepad.exe",
|
|
Arguments = "",
|
|
TryIntegrate = true
|
|
};
|
|
|
|
|
|
[Test]
|
|
public void CanStartExternalApp()
|
|
{
|
|
SetExternalToolList(_extTool);
|
|
var sut = new IntegratedProgram();
|
|
sut.InterfaceControl = BuildInterfaceControl("notepad", sut);
|
|
sut.Initialize();
|
|
var appStarted = sut.Connect();
|
|
sut.Disconnect();
|
|
Assert.That(appStarted);
|
|
}
|
|
|
|
[Test]
|
|
public void ConnectingToExternalAppThatDoesntExistDoesNothing()
|
|
{
|
|
SetExternalToolList(_extTool);
|
|
var sut = new IntegratedProgram();
|
|
sut.InterfaceControl = BuildInterfaceControl("doesntExist", sut);
|
|
var appInitialized = sut.Initialize();
|
|
Assert.That(appInitialized, Is.False);
|
|
}
|
|
|
|
private void SetExternalToolList(ExternalTool externalTool)
|
|
{
|
|
Runtime.ExternalToolsService.ExternalTools = new FullyObservableCollection<ExternalTool> {externalTool};
|
|
}
|
|
|
|
private InterfaceControl BuildInterfaceControl(string extAppName, ProtocolBase sut)
|
|
{
|
|
var connectionWindow = new ConnectionWindow(new DockContent());
|
|
var connectionInfo = new ConnectionInfo {ExtApp = extAppName};
|
|
return new InterfaceControl(connectionWindow, sut, connectionInfo);
|
|
}
|
|
}
|
|
} |