Skip to content

Commit

Permalink
Issue #472 - Code coverage increased for after latest changes in code.
Browse files Browse the repository at this point in the history
(cherry picked from commit 2e4dd43)
  • Loading branch information
OlegRa committed Apr 14, 2024
1 parent 008f80d commit ae61f05
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Alpaca.Markets.Tests/AlpacaTradingClientTest.Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,11 @@ public async Task GetPortfolioHistoryAsyncWorks()
var history = await mock.Client.GetPortfolioHistoryAsync(
new PortfolioHistoryRequest
{
Period = new HistoryPeriod(1, HistoryPeriodUnit.Week),
IntradayReporting = IntradayReporting.Continuous,
IntradayProfitLoss = IntradayProfitLoss.PerDay,
TimeFrame = TimeFrame.FifteenMinutes
}.WithInterval(new Interval<DateTime>(today, today)));
});

Assert.Equal(Price, history.BaseValue);

Expand Down
8 changes: 8 additions & 0 deletions Alpaca.Markets.Tests/RequestValidationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public void OrderBaseNegativeQuantityValidationWorks() =>
public void ListOrdersRequestEmptySymbolValidationWorks() =>
validate(new ListOrdersRequest().WithSymbol(String.Empty));

[Fact]
public void PortfolioHistoryRequestEmptySymbolValidationWorks() =>
validate(new PortfolioHistoryRequest
{
Period = new HistoryPeriod(1, HistoryPeriodUnit.Week)
}
.WithInterval(new Interval<DateTime>(DateTime.Today, DateTime.Today)));

[Fact]
public void CalendarRequestConstructorWorks()
{
Expand Down
2 changes: 2 additions & 0 deletions Alpaca.Markets/Parameters/PortfolioHistoryRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public sealed class PortfolioHistoryRequest : Validation.IRequest
/// This is effective only for time frame less than 1 day.
/// </summary>
[UsedImplicitly]
[ExcludeFromCodeCoverage]
[Obsolete("Use the DateInterval property instead of this one.", false)]
public Boolean? ExtendedHours { get; set; }

Expand Down Expand Up @@ -89,6 +90,7 @@ public PortfolioHistoryRequest WithInterval(
/// <param name="value">New filtering interval.</param>
/// <returns>Request with applied filtering.</returns>
[UsedImplicitly]
[ExcludeFromCodeCoverage]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[Obsolete("Use the override that gets Interval<DateTime> instead of this one.", true)]
public PortfolioHistoryRequest WithInterval(
Expand Down

0 comments on commit ae61f05

Please sign in to comment.