Add tests for CheckUpdatesAsync
MODIFY
WalletWasabi.Tests/IntegrationTests/LiveServerTests.cs
WalletWasabi.Tests/IntegrationTests/LiveServerTests.cs
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using WalletWasabi.Backend.Models.Responses;
using WalletWasabi.Blockchain.BlockFilters;
using WalletWasabi.CoinJoin.Client.Clients;
+using WalletWasabi.Models;
using WalletWasabi.Services;
using WalletWasabi.Tests.XunitConfiguration;
using WalletWasabi.TorSocks5;
@@ -116,10 +117,30 @@ namespace WalletWasabi.Tests.IntegrationTests
var versions = await client.GetVersionsAsync(CancellationToken.None);
Assert.InRange(versions.ClientVersion, new Version(1, 1, 10), new Version(1, 2));
+ Assert.InRange(versions.ClientVersion, new Version(1, 1, 10), WalletWasabi.Helpers.Constants.ClientVersion);
Assert.Equal(3, versions.BackendMajorVersion);
Assert.Equal(new Version(2, 0), versions.LegalDocumentsVersion);
}
+ [Theory]
+ [InlineData(NetworkType.Mainnet)]
+ [InlineData(NetworkType.Testnet)]
+ public async Task CheckUpdatesTestsAsync(NetworkType networkType)
+ {
+ using var client = new WasabiClient(LiveServerTestsFixture.UriMappings[networkType], Global.Instance.TorSocks5Endpoint);
+
+ var updateStatus = await client.CheckUpdatesAsync(CancellationToken.None);
+
+ var expectedVersion = new Version(2, 0);
+ Assert.Equal(new UpdateStatus(true, true, expectedVersion), updateStatus);
+ Assert.True(updateStatus.BackendCompatible);
+ Assert.True(updateStatus.ClientUpToDate);
+ Assert.Equal(expectedVersion, updateStatus.LegalDocumentsVersion);
+
+ var versions = await client.GetVersionsAsync(CancellationToken.None);
+ Assert.Equal(versions.LegalDocumentsVersion, updateStatus.LegalDocumentsVersion);
+ }
+
#endregion Software
}
}

MODIFY
WalletWasabi.Tests/UnitTests/Clients/WasabiClientTests.cs
WalletWasabi.Tests/UnitTests/Clients/WasabiClientTests.cs
@@ -6,6 +6,7 @@ using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Models;
using WalletWasabi.WebClients.Wasabi;
using Xunit;
@@ -90,5 +91,26 @@ namespace WalletWasabi.Tests.UnitTests.Clients
tx.Outputs.Add(Money.Coins(1), Script.Empty);
return tx;
}
+
+ [Fact]
+ public void UpdateStatusEqualityTests()
+ {
+ var u1 = new UpdateStatus(true, true, new Version(1, 0));
+ var u2 = new UpdateStatus(true, true, new Version(1, 0));
+ Assert.Equal(u1, u2);
+ Assert.Equal(u1.GetHashCode(), u2.GetHashCode());
+
+ var u3 = new UpdateStatus(false, true, new Version(1, 0));
+ Assert.NotEqual(u1, u3);
+ Assert.NotEqual(u1.GetHashCode(), u3.GetHashCode());
+
+ var u4 = new UpdateStatus(true, false, new Version(1, 0));
+ Assert.NotEqual(u1, u4);
+ Assert.NotEqual(u1.GetHashCode(), u4.GetHashCode());
+
+ var u5 = new UpdateStatus(true, true, new Version(1, 0, 1));
+ Assert.NotEqual(u1, u5);
+ Assert.NotEqual(u1.GetHashCode(), u5.GetHashCode());
+ }
}
}

Add tests for CheckUpdatesAsync