Skip to content

Commit

Permalink
Issue #728 - Fix failed unit tests (serialize attributes properly).
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegRa committed Feb 28, 2024
1 parent 24a8375 commit dbe9093
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Alpaca.Markets.Tests/AlpacaTradingClientTest.Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ namespace Alpaca.Markets.Tests;

public sealed partial class AlpacaTradingClientTest
{
private static readonly Char[] _doubleQuotes = [ '"' ];

private static String toEnumString<T>(
T enumValue)
where T : struct, Enum =>
JsonConvert.SerializeObject(enumValue).Trim(_doubleQuotes);

[Fact]
public async Task GetAssetAsyncWorks()
{
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit dbe9093

Please sign in to comment.