add tests for update channels

Some code clean up as well...
This commit is contained in:
Sean Kaim
2016-12-13 10:31:16 -05:00
parent 24508abe7a
commit 3f65e1bfa0
5 changed files with 59 additions and 17 deletions

View 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)
{
}
}
}
}

View File

@@ -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" />

View File

@@ -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);

View File

@@ -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)

View File

@@ -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)