1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-11 16:32:57 +00:00

Feature/system.text.json (#192)

Initial support for System.Text.Json and some refactoring
This commit is contained in:
Jan Korf
2024-03-16 14:45:36 +01:00
committed by GitHub
parent 462c857bba
commit 2fb3442800
66 changed files with 2318 additions and 1095 deletions
@@ -1,5 +1,6 @@
using CryptoExchange.Net.Objects;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using System.Globalization;
namespace CryptoExchange.Net.UnitTests
@@ -16,7 +17,7 @@ namespace CryptoExchange.Net.UnitTests
public void ClampValueTests(decimal min, decimal max, decimal input, decimal expected)
{
var result = ExchangeHelpers.ClampValue(min, max, input);
Assert.AreEqual(expected, result);
Assert.That(expected == result);
}
[TestCase(0.1, 1, 0.1, RoundingType.Down, 0.4, 0.4)]
@@ -33,7 +34,7 @@ namespace CryptoExchange.Net.UnitTests
public void AdjustValueStepTests(decimal min, decimal max, decimal? step, RoundingType roundingType, decimal input, decimal expected)
{
var result = ExchangeHelpers.AdjustValueStep(min, max, step, roundingType, input);
Assert.AreEqual(expected, result);
Assert.That(expected == result);
}
[TestCase(0.1, 1, 2, RoundingType.Closest, 0.4, 0.4)]
@@ -48,7 +49,7 @@ namespace CryptoExchange.Net.UnitTests
public void AdjustValuePrecisionTests(decimal min, decimal max, int? precision, RoundingType roundingType, decimal input, decimal expected)
{
var result = ExchangeHelpers.AdjustValuePrecision(min, max, precision, roundingType, input);
Assert.AreEqual(expected, result);
Assert.That(expected == result);
}
[TestCase(5, 0.1563158, 0.15631)]
@@ -59,7 +60,7 @@ namespace CryptoExchange.Net.UnitTests
public void RoundDownTests(int decimalPlaces, decimal input, decimal expected)
{
var result = ExchangeHelpers.RoundDown(input, decimalPlaces);
Assert.AreEqual(expected, result);
Assert.That(expected == result);
}
[TestCase(0.1234560000, "0.123456")]
@@ -67,7 +68,7 @@ namespace CryptoExchange.Net.UnitTests
public void NormalizeTests(decimal input, string expected)
{
var result = ExchangeHelpers.Normalize(input);
Assert.AreEqual(expected, result.ToString(CultureInfo.InvariantCulture));
Assert.That(expected == result.ToString(CultureInfo.InvariantCulture));
}
}
}