Skip to content

Commit

Permalink
Feature/system.text.json (#156)
Browse files Browse the repository at this point in the history
CryptoExchange.Net V7.1.0
  • Loading branch information
JKorf authored Mar 16, 2024
1 parent f01c88d commit 10af129
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 163 deletions.
8 changes: 4 additions & 4 deletions Bitfinex.Net.UnitTests/Bitfinex.Net.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<packagereference Include="Microsoft.NET.Test.Sdk" Version="16.10.0"></packagereference>
<PackageReference Include="Moq" Version="4.16.1" />
<packagereference Include="NUnit" Version="3.13.2"></packagereference>
<packagereference Include="NUnit3TestAdapter" Version="3.17.0"></packagereference>
<packagereference Include="Microsoft.NET.Test.Sdk" Version="17.9.0"></packagereference>
<PackageReference Include="Moq" Version="4.20.70" />
<packagereference Include="NUnit" Version="4.1.0"></packagereference>
<packagereference Include="NUnit3TestAdapter" Version="4.5.0"></packagereference>
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 8 additions & 7 deletions Bitfinex.Net.UnitTests/BitfinexClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Bitfinex.Net.Clients;
using Bitfinex.Net.ExtensionMethods;
using CryptoExchange.Net.Objects.Sockets;
using NUnit.Framework.Legacy;

namespace Bitfinex.Net.UnitTests
{
Expand All @@ -31,9 +32,9 @@ public async Task ReceivingHttpError_Should_ResultInErrorResult()
var result = await client.SpotApi.ExchangeData.GetAssetFullNamesAsync();

// assert
Assert.AreEqual(false, result.Success);
Assert.IsTrue(result.Error.ToString().Contains("Error message"));
Assert.AreEqual(HttpStatusCode.BadRequest, result.ResponseStatusCode);
Assert.That(false == result.Success);
Assert.That(result.Error.ToString().Contains("Error message"));
Assert.That(HttpStatusCode.BadRequest == result.ResponseStatusCode);
}


Expand All @@ -45,7 +46,7 @@ public void ProvidingApiCredentials_Should_SaveApiCredentials()
var authProvider = new BitfinexAuthenticationProvider(new ApiCredentials("TestKey", "TestSecret"), null);

// assert
Assert.AreEqual(authProvider.GetApiKey(), "TestKey");
Assert.That(authProvider.GetApiKey() == "TestKey");
}

[Test]
Expand All @@ -58,7 +59,7 @@ public void SigningString_Should_ReturnCorrectString()
string signed = authProvider.Sign("SomeTestString");

// assert
Assert.AreEqual(signed, "9052C73092B21B945BC5859CADBA6A5658E142F021FCB092A72F68E8A0D5E6351CFEBAE52DB9067D4360F796CB520960");
Assert.That(signed == "9052C73092B21B945BC5859CADBA6A5658E142F021FCB092A72F68E8A0D5E6351CFEBAE52DB9067D4360F796CB520960");
}

[Test]
Expand Down Expand Up @@ -112,7 +113,7 @@ public void CheckRestInterfaces()
foreach (var method in implementation.GetMethods().Where(m => m.ReturnType.IsAssignableTo(typeof(Task))))
{
var interfaceMethod = clientInterface.GetMethod(method.Name, method.GetParameters().Select(p => p.ParameterType).ToArray());
Assert.NotNull(interfaceMethod, $"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
ClassicAssert.NotNull(interfaceMethod, $"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
methods++;
}
Debug.WriteLine($"{clientInterface.Name} {methods} methods validated");
Expand All @@ -132,7 +133,7 @@ public void CheckSocketInterfaces()
foreach (var method in implementation.GetMethods().Where(m => m.ReturnType.IsAssignableTo(typeof(Task<CallResult<UpdateSubscription>>))))
{
var interfaceMethod = clientInterface.GetMethod(method.Name, method.GetParameters().Select(p => p.ParameterType).ToArray());
Assert.NotNull(interfaceMethod, $"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
ClassicAssert.NotNull(interfaceMethod, $"Missing interface for method {method.Name} in {implementation.Name} implementing interface {clientInterface.Name}");
methods++;
}
Debug.WriteLine($"{clientInterface.Name} {methods} methods validated");
Expand Down
Loading

0 comments on commit 10af129

Please sign in to comment.