From dbe90939591f56c56d6b0b7c0b447f5e6b7e804d Mon Sep 17 00:00:00 2001 From: Oleg Rakhmatulin Date: Wed, 28 Feb 2024 14:27:40 +0100 Subject: [PATCH] Issue #728 - Fix failed unit tests (serialize attributes properly). --- Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs b/Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs index 6c9afa05..ac3e03aa 100644 --- a/Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs +++ b/Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs @@ -4,6 +4,13 @@ namespace Alpaca.Markets.Tests; public sealed partial class AlpacaTradingClientTest { + private static readonly Char[] _doubleQuotes = [ '"' ]; + + private static String toEnumString( + T enumValue) + where T : struct, Enum => + JsonConvert.SerializeObject(enumValue).Trim(_doubleQuotes); + [Fact] public async Task GetAssetAsyncWorks() { @@ -42,7 +49,8 @@ private static JObject createAsset( Guid assetId, String symbol) => new( - new JProperty("attributes", new JArray(AssetAttributes.PtpNoException)), + new JProperty("attributes", new JArray( + toEnumString(AssetAttributes.PtpNoException))), new JProperty("maintenance_margin_requirement", 100), new JProperty("status", AssetStatus.Active), new JProperty("class", AssetClass.UsEquity),