Add more tests, fix equality
MODIFY
WalletWasabi.Gui/Tabs/AboutViewModel.cs
WalletWasabi.Gui/Tabs/AboutViewModel.cs
@@ -25,6 +25,13 @@ namespace WalletWasabi.Gui.Tabs
public AboutViewModel() : base("About")
{
+ var global = Locator.Current.GetService<Global>();
+ var hostedServices = global.HostedServices;
+
+ UpdateChecker = hostedServices.FirstOrDefault<UpdateChecker>();
+
+ CurrentBackendMajorVersion = UpdateChecker.UpdateStatus.CurrentBackendApiVersion;
+
OpenBrowserCommand = ReactiveCommand.CreateFromTask<string>(IoHelpers.OpenBrowserAsync);
OpenBrowserCommand.ThrownExceptions
@@ -33,7 +40,7 @@ namespace WalletWasabi.Gui.Tabs
}
public ReactiveCommand<string, Unit> OpenBrowserCommand { get; }
-
+ private UpdateChecker UpdateChecker { get; }
public Version ClientVersion => Constants.ClientVersion;
public string BackendCompatibleVersions => Constants.ClientSupportBackendVersionText;
@@ -66,11 +73,7 @@ namespace WalletWasabi.Gui.Tabs
{
base.OnOpen(disposables);
- var global = Locator.Current.GetService<Global>();
- var hostedServices = global.HostedServices;
-
- var updateChecker = hostedServices.FirstOrDefault<UpdateChecker>();
- Observable.FromEventPattern<UpdateStatus>(updateChecker, nameof(updateChecker.UpdateStatusChanged))
+ Observable.FromEventPattern<UpdateStatus>(UpdateChecker, nameof(UpdateChecker.UpdateStatusChanged))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(e => CurrentBackendMajorVersion = e.EventArgs.CurrentBackendApiVersion)
.DisposeWith(disposables);

MODIFY
WalletWasabi.Tests/UnitTests/Clients/WasabiClientTests.cs
WalletWasabi.Tests/UnitTests/Clients/WasabiClientTests.cs
@@ -4,6 +4,7 @@ using System;
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Reflection.Metadata;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Models;
@@ -116,5 +117,13 @@ namespace WalletWasabi.Tests.UnitTests.Clients
Assert.NotEqual(u1, u6);
Assert.NotEqual(u1.GetHashCode(), u6.GetHashCode());
}
+
+ [Fact]
+ public void ClientSupportBackendVersionTests()
+ {
+ var min = int.Parse(WalletWasabi.Helpers.Constants.ClientSupportBackendVersionMin);
+ var max = int.Parse(WalletWasabi.Helpers.Constants.ClientSupportBackendVersionMax);
+ Assert.True(min <= max);
+ }
}
}

MODIFY
WalletWasabi/Models/UpdateStatus.cs
WalletWasabi/Models/UpdateStatus.cs
@@ -26,10 +26,10 @@ namespace WalletWasabi.Models
public bool Equals(UpdateStatus other) => this == other;
- public override int GetHashCode() => (ClientUpToDate, BackendCompatible, LegalDocumentsVersion).GetHashCode();
+ public override int GetHashCode() => (ClientUpToDate, BackendCompatible, LegalDocumentsVersion, CurrentBackendApiVersion).GetHashCode();
public static bool operator ==(UpdateStatus x, UpdateStatus y)
- => (x?.ClientUpToDate, x?.BackendCompatible, x?.LegalDocumentsVersion) == (y?.ClientUpToDate, y?.BackendCompatible, y?.LegalDocumentsVersion);
+ => (x?.ClientUpToDate, x?.BackendCompatible, x?.LegalDocumentsVersion, x?.CurrentBackendApiVersion) == (y?.ClientUpToDate, y?.BackendCompatible, y?.LegalDocumentsVersion, y?.CurrentBackendApiVersion);
public static bool operator !=(UpdateStatus x, UpdateStatus y) => !(x == y);

Add more tests, fix equality