Fix #2592: Prevent GeneralAppInfo.ApplicationVersion from being set in Unit Tests. Not needed for tests.

This commit is contained in:
xRushG
2024-05-29 15:20:56 +02:00
parent 49a1549e5a
commit 99d9e70921

View File

@@ -9,75 +9,59 @@ namespace mRemoteNGTests.App;
[TestFixture]
public class UpdaterTests
{
private readonly Version TestApplicationVersion = new("1.0.0.0");
[Test]
public void UpdateStableChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.update);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
[Test]
public void UpdateBetaChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.beta_update);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
[Test]
public void UpdateDevChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.dev_update);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
[Test]
public void UpdateStablePortableChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.update_portable);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
[Test]
public void UpdateBetaPortableChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.beta_update_portable);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
[Test]
public void UpdateDevPortableChannel()
{
GeneralAppInfo.ApplicationVersion = "1.0.0.0";
var CurrentUpdateInfo = UpdateInfo.FromString(Resources.dev_update_portable);
Assert.That(CurrentUpdateInfo.CheckIfValid(), Is.True);
Version v;
Version.TryParse(GeneralAppInfo.ApplicationVersion, out v);
var IsNewer = CurrentUpdateInfo.Version > v;
bool IsNewer = CurrentUpdateInfo.Version > TestApplicationVersion;
Assert.That(IsNewer, Is.True);
}
}