diff --git a/NBitcoin.Bench/NBitcoin.Bench.csproj b/NBitcoin.Bench/NBitcoin.Bench.csproj
index cfd187a5d5..7ad6e6c7b2 100644
--- a/NBitcoin.Bench/NBitcoin.Bench.csproj
+++ b/NBitcoin.Bench/NBitcoin.Bench.csproj
@@ -2,14 +2,14 @@
Exe
- net6.0;netcoreapp3.1
+ net6.0
pdbonly
true
-
-
+
+
diff --git a/NBitcoin.Tests/AssertEx.cs b/NBitcoin.Tests/AssertEx.cs
index b9800fea27..d18daa6ad1 100644
--- a/NBitcoin.Tests/AssertEx.cs
+++ b/NBitcoin.Tests/AssertEx.cs
@@ -14,7 +14,7 @@ class AssertEx
[DebuggerHidden]
internal static void Error(string msg)
{
- Assert.False(true, msg);
+ Assert.Fail(msg);
}
[DebuggerHidden]
internal static void Equal(T actual, T expected)
@@ -25,12 +25,12 @@ internal static void Equal(T actual, T expected)
internal static void CollectionEquals(T[] actual, T[] expected)
{
if (actual.Length != expected.Length)
- Assert.False(true, "Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");
+ Assert.Fail("Actual.Length(" + actual.Length + ") != Expected.Length(" + expected.Length + ")");
for (int i = 0; i < actual.Length; i++)
{
if (!Object.Equals(actual[i], expected[i]))
- Assert.False(true, "Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
+ Assert.Fail("Actual[" + i + "](" + actual[i] + ") != Expected[" + i + "](" + expected[i] + ")");
}
}
[DebuggerHidden]
diff --git a/NBitcoin.Tests/NBitcoin.Tests.csproj b/NBitcoin.Tests/NBitcoin.Tests.csproj
index 944ab5bf1a..4b029488eb 100644
--- a/NBitcoin.Tests/NBitcoin.Tests.csproj
+++ b/NBitcoin.Tests/NBitcoin.Tests.csproj
@@ -30,33 +30,30 @@
true
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
-
+
+
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/NBitcoin.Tests/ProtocolTests.cs b/NBitcoin.Tests/ProtocolTests.cs
index 67fb4dec32..121dcf3729 100644
--- a/NBitcoin.Tests/ProtocolTests.cs
+++ b/NBitcoin.Tests/ProtocolTests.cs
@@ -277,7 +277,7 @@ public void CanProcessAddressGossip()
[Fact]
[Trait("Protocol", "Protocol")]
- public void CanHandshakeRestrictNodes()
+ public async Task CanHandshakeRestrictNodes()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -303,7 +303,7 @@ public void CanHandshakeRestrictNodes()
try
{
group.Connect();
- connecting.GetAwaiter().GetResult();
+ await connecting;
}
catch (TaskCanceledException)
{
@@ -322,7 +322,7 @@ public void CanHandshakeRestrictNodes()
try
{
group.Connect();
- connecting.GetAwaiter().GetResult();
+ await connecting;
Eventually(() =>
{
Assert.NotEmpty(group.ConnectedNodes);
@@ -339,7 +339,7 @@ public void CanHandshakeRestrictNodes()
[Fact]
[Trait("Protocol", "Protocol")]
- public void CanHandshakeWithSeveralTemplateBehaviors()
+ public async Task CanHandshakeWithSeveralTemplateBehaviors()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -371,7 +371,7 @@ public void CanHandshakeWithSeveralTemplateBehaviors()
{
group.Connect();
- connecting.GetAwaiter().GetResult();
+ await connecting;
Eventually(() =>
{
Assert.Equal(101, chain.Height);
@@ -670,7 +670,7 @@ public void CanCancelConnection()
{
ConnectCancellation = cts.Token
});
- Assert.False(true, "Should have thrown");
+ Assert.Fail("Should have thrown");
}
catch (OperationCanceledException)
{
diff --git a/NBitcoin.Tests/RPCClientTests.cs b/NBitcoin.Tests/RPCClientTests.cs
index fad3f47980..afb0d31519 100644
--- a/NBitcoin.Tests/RPCClientTests.cs
+++ b/NBitcoin.Tests/RPCClientTests.cs
@@ -103,7 +103,7 @@ public void CanGetNewAddress()
}
[Fact]
- public void CanUseMultipleWallets()
+ public async Task CanUseMultipleWallets()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -114,7 +114,7 @@ public void CanUseMultipleWallets()
node.Start();
var rpc = node.CreateRPCClient();
var w1 = rpc.CreateWallet("w1");
- w1.SendCommandAsync(RPCOperations.getwalletinfo).GetAwaiter().GetResult().ThrowIfError();
+ (await w1.SendCommandAsync(RPCOperations.getwalletinfo)).ThrowIfError();
Assert.NotNull(w1.GetBalance());
Assert.NotNull(rpc.GetBestBlockHash());
var address = w1.GetNewAddress();
@@ -128,9 +128,9 @@ public void CanUseMultipleWallets()
var b2 = rpc.GetBestBlockHashAsync();
var a = w1b.SendCommandAsync(RPCOperations.gettransaction, block.Transactions.First().GetHash().ToString());
rpc.SendBatch();
- b.GetAwaiter().GetResult();
- b2.GetAwaiter().GetResult();
- a.GetAwaiter().GetResult();
+ await b;
+ await b2;
+ await a;
var noWalletRPC = noWalletNode.CreateRPCClient();
Assert.Throws(() => noWalletRPC.GetNewAddress());
@@ -271,7 +271,7 @@ public async Task RPCBatchingCanFallbackIfAccessForbidden()
}
[Fact]
- public void CanUseAsyncRPC()
+ public async Task CanUseAsyncRPC()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -279,7 +279,7 @@ public void CanUseAsyncRPC()
var rpc = node.CreateRPCClient();
builder.StartAll();
node.Generate(10);
- var blkCount = rpc.GetBlockCountAsync().Result;
+ var blkCount = await rpc.GetBlockCountAsync();
Assert.Equal(10, blkCount);
}
}
@@ -588,7 +588,7 @@ public async Task CanGetTxOutFromRPCAsync()
index = i;
}
}
- Assert.NotEqual(index, -1);
+ Assert.NotEqual(-1, index);
// 5. Make sure the expected amounts are received for unconfirmed transactions
getTxOutResponse = await rpc.GetTxOutAsync(txId, index, true);
@@ -1236,7 +1236,7 @@ public async Task CanBatchRequestPartiallySucceed()
}
}
[Fact]
- public void CanUseBatchedRequests()
+ public async Task CanUseBatchedRequests()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -1261,7 +1261,7 @@ public void CanUseBatchedRequests()
int blockIndex = 0;
foreach (var req in requests)
{
- Assert.Equal(blocks[blockIndex], req.Result);
+ Assert.Equal(blocks[blockIndex], await req);
Assert.Equal(TaskStatus.RanToCompletion, req.Status);
blockIndex++;
}
@@ -1628,7 +1628,7 @@ public void CanParseEndpoint()
}
[Fact]
- public void CanAuthWithCookieFile()
+ public async Task CanAuthWithCookieFile()
{
#if NOFILEIO
Assert.Throws(() => new RPCClient(Network.Main));
@@ -1656,14 +1656,14 @@ public void CanAuthWithCookieFile()
rpc = rpc.PrepareBatch();
var blockCountAsync = rpc.GetBlockCountAsync();
rpc.SendBatch();
- var blockCount = blockCountAsync.GetAwaiter().GetResult();
+ var blockCount = await blockCountAsync;
node.Restart();
rpc = rpc.PrepareBatch();
blockCountAsync = rpc.GetBlockCountAsync();
rpc.SendBatch();
- blockCount = blockCountAsync.GetAwaiter().GetResult();
+ blockCount = await blockCountAsync;
rpc = new RPCClient("bla:bla", "http://toto/", Network.RegTest);
}
@@ -1681,13 +1681,13 @@ public void RPCSendRPCException()
try
{
rpcClient.SendCommand("whatever");
- Assert.False(true, "Should have thrown");
+ Assert.Fail("Should have thrown");
}
catch (RPCException ex)
{
if (ex.RPCCode != RPCErrorCode.RPC_METHOD_NOT_FOUND)
{
- Assert.False(true, "Should have thrown RPC_METHOD_NOT_FOUND");
+ Assert.Fail("Should have thrown RPC_METHOD_NOT_FOUND");
}
}
}
@@ -1951,7 +1951,7 @@ public void ShouldWalletProcessPSBTAndExtractMempoolAcceptableTX()
// 3. In version 0.17, `importmulti` can not handle witness script so only p2sh are considered here. TODO: fix
[Theory]
[InlineData("latest")]
- public void ShouldPerformMultisigProcessingWithCore(string version)
+ public async Task ShouldPerformMultisigProcessingWithCore(string version)
{
using (var builder = NodeBuilderEx.Create(NodeDownloadData.Bitcoin.FromVersion(version)))
{
@@ -2027,7 +2027,7 @@ public void ShouldPerformMultisigProcessingWithCore(string version)
// first carol creates psbt
var carol = clients[2];
// check if we have enough balance
- var info = carol.GetBlockchainInfoAsync().Result;
+ var info = await carol.GetBlockchainInfoAsync();
Assert.Equal((ulong)104, info.Blocks);
var balance = carol.GetBalance(0, true);
// Assert.Equal(Money.Coins(120), balance);
@@ -2196,7 +2196,7 @@ void AssertException(Action act, Action assert) where T : Exception
try
{
act();
- Assert.False(true, "Should have thrown an exception");
+ Assert.Fail("Should have thrown an exception");
}
catch (T ex)
{
diff --git a/NBitcoin.Tests/RepositoryTests.cs b/NBitcoin.Tests/RepositoryTests.cs
index c4ca8d89f0..a09f4a7541 100644
--- a/NBitcoin.Tests/RepositoryTests.cs
+++ b/NBitcoin.Tests/RepositoryTests.cs
@@ -180,16 +180,13 @@ public void TwoGroupsCanSendToSameDestination()
Assert.Equal(3, tx.Outputs.Count);
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == bob.GetScriptPubKey(ScriptPubKeyType.Legacy))
- .Where(o => o.Value == Money.Coins(0.3m) + Money.Coins(0.1m))
-);
+, o => o.Value == Money.Coins(0.3m) + Money.Coins(0.1m));
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == alice.GetScriptPubKey(ScriptPubKeyType.Legacy))
- .Where(o => o.Value == Money.Coins(0.7m))
-);
+, o => o.Value == Money.Coins(0.7m));
Assert.Single(tx.Outputs
.Where(o => o.ScriptPubKey == carol.GetScriptPubKey(ScriptPubKeyType.Legacy))
- .Where(o => o.Value == Money.Coins(1.0m))
-);
+, o => o.Value == Money.Coins(1.0m));
}
[Fact]
diff --git a/NBitcoin.Tests/RestClientTests.cs b/NBitcoin.Tests/RestClientTests.cs
index 8951117a95..280ea29af0 100644
--- a/NBitcoin.Tests/RestClientTests.cs
+++ b/NBitcoin.Tests/RestClientTests.cs
@@ -1,6 +1,7 @@
using NBitcoin.RPC;
using System;
using System.Linq;
+using System.Threading.Tasks;
using Xunit;
namespace NBitcoin.Tests
@@ -14,19 +15,19 @@ public class RestClientTests
private static readonly Block RegNetGenesisBlock = Network.RegTest.GetGenesis();
[Fact]
- public void CanGetChainInfo()
+ public async Task CanGetChainInfo()
{
using (var builder = NodeBuilderEx.Create())
{
var client = builder.CreateNode().CreateRESTClient();
builder.StartAll();
- var info = client.GetChainInfoAsync().Result;
+ var info = await client.GetChainInfoAsync();
Assert.Equal("regtest", info.Chain);
}
}
[Fact]
- public void CanCalculateChainWork()
+ public async Task CanCalculateChainWork()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -34,30 +35,30 @@ public void CanCalculateChainWork()
var client = node.CreateRESTClient();
var rpc = node.CreateRPCClient();
builder.StartAll();
- var info = client.GetChainInfoAsync().Result;
+ var info = await client.GetChainInfoAsync();
Assert.Equal("regtest", info.Chain);
Assert.Equal(new ChainedBlock(Network.RegTest.GetGenesis().Header, 0).GetChainWork(false), info.ChainWork);
rpc.Generate(10);
var chain = node.CreateNodeClient().GetChain();
- info = client.GetChainInfoAsync().Result;
+ info = await client.GetChainInfoAsync();
Assert.Equal(info.ChainWork, chain.Tip.GetChainWork(false));
}
}
[Fact]
- public void CanGetBlock()
+ public async Task CanGetBlock()
{
using (var builder = NodeBuilderEx.Create())
{
var client = builder.CreateNode().CreateRESTClient();
builder.StartAll();
- var block = client.GetBlockAsync(RegNetGenesisBlock.GetHash()).Result;
+ var block = await client.GetBlockAsync(RegNetGenesisBlock.GetHash());
Assert.Equal(block.GetHash(), RegNetGenesisBlock.GetHash());
}
}
[Fact]
- public void CanGetBlockHeader()
+ public async Task CanGetBlockHeader()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -65,7 +66,7 @@ public void CanGetBlockHeader()
var rpc = builder.Nodes[0].CreateRPCClient();
builder.StartAll();
rpc.Generate(2);
- var result = client.GetBlockHeadersAsync(RegNetGenesisBlock.GetHash(), 3).Result;
+ var result = await client.GetBlockHeadersAsync(RegNetGenesisBlock.GetHash(), 3);
var headers = result.ToArray();
var last = headers.Last();
Assert.Equal(3, headers.Length);
@@ -76,7 +77,7 @@ public void CanGetBlockHeader()
}
[Fact]
- public void CanGetTransaction()
+ public async Task CanGetTransaction()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -85,14 +86,14 @@ public void CanGetTransaction()
builder.Nodes[0].Generate(1);
var block = builder.Nodes[0].CreateRPCClient().GetBestBlockHash();
var txId = builder.Nodes[0].CreateRPCClient().GetBlock(block).Transactions[0].GetHash();
- var tx = client.GetTransactionAsync(txId).Result;
+ var tx = await client.GetTransactionAsync(txId);
Assert.True(tx.IsCoinBase);
Assert.Equal(Money.Coins(50), tx.TotalOut);
}
}
[Fact]
- public void CanGetUTXOsMempool()
+ public async Task CanGetUTXOsMempool()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -107,7 +108,7 @@ public void CanGetUTXOsMempool()
var c = rpc.ListUnspent().First();
c = rpc.ListUnspent(0, 999999, k.GetAddress(ScriptPubKeyType.Legacy)).First();
var outPoint = c.OutPoint;
- var utxos = client.GetUnspentOutputsAsync(new[] { outPoint }, true).Result;
+ var utxos = await client.GetUnspentOutputsAsync(new[] { outPoint }, true);
Assert.Single(utxos.Outputs);
Assert.Equal(0, (int)utxos.Outputs[0].Version);
Assert.Equal(Money.Coins(50m), utxos.Outputs[0].Output.Value);
@@ -120,7 +121,7 @@ public void CanGetUTXOsMempool()
}
[Fact]
- public void CanGetUTXOs()
+ public async Task CanGetUTXOs()
{
using (var builder = NodeBuilderEx.Create())
{
@@ -128,7 +129,7 @@ public void CanGetUTXOs()
builder.StartAll();
var txId = uint256.Parse("3a3422dfd155f1d2ffc3e46cf978a9c5698c17c187f04cfa1b93358699c4ed3f");
var outPoint = new OutPoint(txId, 0);
- var utxos = client.GetUnspentOutputsAsync(new[] { outPoint }, false).Result;
+ var utxos = await client.GetUnspentOutputsAsync(new[] { outPoint }, false);
Assert.True(utxos.Bitmap[0]);
Assert.False(utxos.Bitmap[1]);
Assert.Empty(utxos.Outputs);
diff --git a/NBitcoin.Tests/Secp256k1Tests.cs b/NBitcoin.Tests/Secp256k1Tests.cs
index e7bc2eea45..db32db6597 100644
--- a/NBitcoin.Tests/Secp256k1Tests.cs
+++ b/NBitcoin.Tests/Secp256k1Tests.cs
@@ -4131,7 +4131,7 @@ public void musig_sign_verify_vectors()
invalidKeys = true;
new MusigContext(keys, msg, sk.CreatePubKey());
invalidKeys = false;
- Assert.False(true, comment);
+ Assert.Fail(comment);
}
catch (Exception ex) when (!(ex is XunitException))
{
@@ -4139,19 +4139,19 @@ public void musig_sign_verify_vectors()
{
var err = item["error"]?["type"]?.Value();
if (invalidKeys != (err == "value"))
- Assert.False(true, comment);
+ Assert.Fail(comment);
}
else
{
var err = item["error"]?["contrib"]?.Value();
if (invalidPubKey != (err == "pubkey"))
- Assert.False(true, comment);
+ Assert.Fail(comment);
if (invalidNonceAgg != (err == "aggnonce"))
- Assert.False(true, comment);
+ Assert.Fail(comment);
if (invalidNonce != (err == "pubnonce"))
- Assert.False(true, comment);
+ Assert.Fail(comment);
if (invalidSecnonce != (err == null))
- Assert.False(true, comment);
+ Assert.Fail(comment);
}
}
}
diff --git a/NBitcoin.Tests/base58_tests.cs b/NBitcoin.Tests/base58_tests.cs
index abaaa48285..4e182a5c69 100644
--- a/NBitcoin.Tests/base58_tests.cs
+++ b/NBitcoin.Tests/base58_tests.cs
@@ -89,7 +89,7 @@ public void base58_keys_valid_parse()
string strTest = test.ToString();
if (test.Count < 3) // Allow for extra stuff (useful for comments)
{
- Assert.True(false, "Bad test " + strTest);
+ Assert.Fail("Bad test " + strTest);
continue;
}
@@ -149,7 +149,7 @@ public void base58_keys_valid_gen()
string strTest = test.ToString();
if (test.Count < 3) // Allow for extra stuff (useful for comments)
{
- Assert.False(true, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
string exp_base58string = (string)test[0];
@@ -196,7 +196,7 @@ public void base58_keys_valid_gen()
}
else
{
- Assert.True(false, "Bad addrtype: " + strTest);
+ Assert.Fail("Bad addrtype: " + strTest);
continue;
}
BitcoinAddress addrOut = dest.GetAddress(network);
diff --git a/NBitcoin.Tests/script_tests.cs b/NBitcoin.Tests/script_tests.cs
index d1e2712749..bf5d7ef7d3 100644
--- a/NBitcoin.Tests/script_tests.cs
+++ b/NBitcoin.Tests/script_tests.cs
@@ -80,7 +80,7 @@ public static Script ParseScript(string s)
}
else
{
- Assert.True(false, "Invalid test");
+ Assert.Fail("Invalid test");
return null;
}
}
@@ -1508,9 +1508,9 @@ public async Task scripts_tests3()
if (expectedSuccess != result.Error is null)
{
if (expectedSuccess)
- Assert.False(true, $"Expected success, but got {result.Error.Value}");
+ Assert.Fail($"Expected success, but got {result.Error.Value}");
else
- Assert.False(true, "Expected failed but passed");
+ Assert.Fail("Expected failed but passed");
}
Assert.Equal(expectedSuccess, result.Error is null);
expectedSuccess = false;
diff --git a/NBitcoin.Tests/sighash_tests.cs b/NBitcoin.Tests/sighash_tests.cs
index 93035ac63d..9873eaa34d 100644
--- a/NBitcoin.Tests/sighash_tests.cs
+++ b/NBitcoin.Tests/sighash_tests.cs
@@ -22,7 +22,7 @@ public void sighash_from_data()
var strTest = test.ToString();
if (test.Count < 1) // Allow for extra stuff (useful for comments)
{
- Assert.True(false, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
if (test.Count == 1)
diff --git a/NBitcoin.Tests/transaction_tests.cs b/NBitcoin.Tests/transaction_tests.cs
index c7fcd72ee1..cee4bfcaf3 100644
--- a/NBitcoin.Tests/transaction_tests.cs
+++ b/NBitcoin.Tests/transaction_tests.cs
@@ -607,7 +607,7 @@ public void KnapsackSolverTest()
if (equal_sets(setCoinsRet, setCoinsRet2))
fails++;
}
- Assert.NotEqual(fails, RANDOM_REPEATS);
+ Assert.NotEqual(RANDOM_REPEATS, fails);
}
// add 75 cents in small change. not enough to make 90 cents,
@@ -631,7 +631,7 @@ public void KnapsackSolverTest()
if (equal_sets(setCoinsRet, setCoinsRet2))
fails++;
}
- Assert.NotEqual(fails, RANDOM_REPEATS);
+ Assert.NotEqual(RANDOM_REPEATS, fails);
}
}
@@ -1479,7 +1479,7 @@ public void CanBuildColoredTransaction()
.SendAsset(alice.PubKey.Hash, new AssetMoney(goldId, 40UL))
.SetChange(bob.PubKey.Hash)
.BuildTransaction(true);
- Assert.False(true, "Should have thrown");
+ Assert.Fail("Should have thrown");
}
catch (NotEnoughFundsException ex) //Not enough dust to send the change
{
@@ -3734,7 +3734,7 @@ public void tx_valid()
JArray inputs = (JArray)test[0];
if (test.Count != 3 || !(test[1] is string) || !(test[2] is string))
{
- Assert.False(true, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
@@ -3755,7 +3755,7 @@ public void tx_valid()
{
if (!mapprevOutScriptPubKeys.ContainsKey(input.PrevOut))
{
- Assert.False(true, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
@@ -3792,7 +3792,7 @@ ScriptVerify ParseFlags(string strFlags)
foreach (string word in words)
{
if (!mapFlagNames.ContainsKey(word))
- Assert.False(true, "Bad test: unknown verification flag '" + word + "'");
+ Assert.Fail("Bad test: unknown verification flag '" + word + "'");
flags |= mapFlagNames[word];
}
@@ -3867,7 +3867,7 @@ public void tx_invalid()
JArray inputs = (JArray)test[0];
if (test.Count != 3 || !(test[1] is string) || !(test[2] is string))
{
- Assert.False(true, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
Dictionary mapprevOutScriptPubKeys = new Dictionary();
@@ -3888,7 +3888,7 @@ public void tx_invalid()
break;
if (!mapprevOutScriptPubKeys.ContainsKey(input.PrevOut))
{
- Assert.False(true, "Bad test: " + strTest);
+ Assert.Fail("Bad test: " + strTest);
continue;
}
var txOut = new TxOut(mapprevOutScriptPubKeysAmount.TryGet(input.PrevOut), mapprevOutScriptPubKeys[input.PrevOut]);
diff --git a/NBitcoin.Tests/util_tests.cs b/NBitcoin.Tests/util_tests.cs
index 677998e4fc..598e902308 100644
--- a/NBitcoin.Tests/util_tests.cs
+++ b/NBitcoin.Tests/util_tests.cs
@@ -331,18 +331,18 @@ public void CanReadConvertTargetToDifficulty()
Assert.Equal(16307.420938523983D, packed.Difficulty, "420938523983".Length);
Assert.Equal(packed, new Target(0x1b0404cb));
- Assert.Equal((uint)packed, (uint)0x1b0404cb);
+ Assert.Equal((uint)0x1b0404cb, (uint)packed);
packed = new Target(0x1b0404d1);
Assert.Equal(16307.04943863739, packed.Difficulty, "420938523983".Length);
packed = new Target(0x1d00ffff);
- Assert.Equal((uint)packed, (uint)0x1d00ffff);
+ Assert.Equal((uint)0x1d00ffff, (uint)packed);
//Check http://blockchain.info/block-index/392672/0000000000000000511e193e22d2dfc02aea8037988f0c58e9834f4550e97702
packed = new Target(419470732);
Assert.Equal(6978842649.592383, packed.Difficulty, "592383".Length);
- Assert.Equal((uint)packed, (uint)419470732);
+ Assert.Equal((uint)419470732, (uint)packed);
Assert.True(uint256.Parse("0x0000000000000000511e193e22d2dfc02aea8037988f0c58e9834f4550e97702") < packed.ToUInt256());
//Check http://blockchain.info/block-index/394713/0000000000000000729a4a7e084c90f932d038c407a6535a51dfecdfba1c8906