mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
add tests for update channels
Some code clean up as well...
This commit is contained in:
45
mRemoteNGTests/App/UpdaterTests.cs
Normal file
45
mRemoteNGTests/App/UpdaterTests.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.App.Update;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.App
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdaterTests
|
||||
{
|
||||
private AppUpdater _appUpdate;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
|
||||
_appUpdate = new AppUpdater();
|
||||
_appUpdate.GetUpdateInfoCompletedEvent += TestGetUpdateInfoCompleted;
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStableChannel()
|
||||
{
|
||||
}
|
||||
|
||||
private void TestGetUpdateInfoCompleted(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_appUpdate.GetUpdateInfoCompletedEvent -= TestGetUpdateInfoCompleted;
|
||||
|
||||
if (_appUpdate.IsUpdateAvailable())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="App\LoggerTests.cs" />
|
||||
<Compile Include="App\UpdaterTests.cs" />
|
||||
<Compile Include="BinaryFileTests.cs" />
|
||||
<Compile Include="Config\Serializers\DataTableSerializerTests.cs" />
|
||||
<Compile Include="Config\Serializers\PortScanDeserializerTests.cs" />
|
||||
|
||||
@@ -11,11 +11,11 @@ namespace mRemoteNG.App.Info
|
||||
{
|
||||
public static class GeneralAppInfo
|
||||
{
|
||||
public static readonly string UrlHome = "http://www.mremoteng.org/";
|
||||
public static readonly string UrlDonate = "http://donate.mremoteng.org/";
|
||||
public static readonly string UrlForum = "http://forum.mremoteng.org/";
|
||||
public static readonly string UrlBugs = "http://bugs.mremoteng.org/";
|
||||
public static readonly string ApplicationVersion = Application.ProductVersion;
|
||||
public const string UrlHome = "http://www.mremoteng.org/";
|
||||
public const string UrlDonate = "http://donate.mremoteng.org/";
|
||||
public const string UrlForum = "http://forum.mremoteng.org/";
|
||||
public const string UrlBugs = "http://bugs.mremoteng.org/";
|
||||
public static string ApplicationVersion = Application.ProductVersion;
|
||||
public static readonly string ProductName = Application.ProductName;
|
||||
public static readonly string Copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
|
||||
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace mRemoteNG.App.Update
|
||||
#if !PORTABLE
|
||||
public string CertificateThumbprint { get; private set; }
|
||||
#endif
|
||||
public string FileName { get; private set; }
|
||||
private string FileName { get; set; }
|
||||
public string Checksum { get; private set; }
|
||||
|
||||
public static UpdateInfo FromString(string input)
|
||||
|
||||
@@ -163,17 +163,13 @@ namespace mRemoteNG.UI.Window
|
||||
{
|
||||
lblStatus.Text = Language.strNoUpdateAvailable;
|
||||
lblStatus.ForeColor = Color.ForestGreen;
|
||||
|
||||
if (_appUpdate.CurrentUpdateInfo != null)
|
||||
{
|
||||
var updateInfo = _appUpdate.CurrentUpdateInfo;
|
||||
if (updateInfo.IsValid && updateInfo.Version != null)
|
||||
{
|
||||
lblLatestVersion.Text = updateInfo.Version.ToString();
|
||||
lblLatestVersionLabel.Visible = true;
|
||||
lblLatestVersion.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (_appUpdate.CurrentUpdateInfo == null) return;
|
||||
var updateInfo = _appUpdate.CurrentUpdateInfo;
|
||||
if (!updateInfo.IsValid || updateInfo.Version == null) return;
|
||||
lblLatestVersion.Text = updateInfo.Version.ToString();
|
||||
lblLatestVersionLabel.Visible = true;
|
||||
lblLatestVersion.Visible = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user