Skip to content

Commit 6242453

Browse files
authored
Fix GetAnalystEstimatesAsync (#68)
* Update GetAnalystEstimatesAsync Tests * Make data points nullable, fixes #66
1 parent ff0470a commit 6242453

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

FinancialModelingPrepApi/Model/Statistics/AnalystEstimateItem.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,58 @@ public class AnalystEstimateItem
1111
public string Date { get; set; }
1212

1313
[JsonPropertyName("estimatedRevenueLow")]
14-
public double EstimatedRevenueLow { get; set; }
14+
public double? EstimatedRevenueLow { get; set; }
1515

1616
[JsonPropertyName("estimatedRevenueHigh")]
17-
public double EstimatedRevenueHigh { get; set; }
17+
public double? EstimatedRevenueHigh { get; set; }
1818

1919
[JsonPropertyName("estimatedRevenueAvg")]
20-
public double EstimatedRevenueAvg { get; set; }
20+
public double? EstimatedRevenueAvg { get; set; }
2121

2222
[JsonPropertyName("estimatedEbitdaLow")]
23-
public double EstimatedEbitdaLow { get; set; }
23+
public double? EstimatedEbitdaLow { get; set; }
2424

2525
[JsonPropertyName("estimatedEbitdaHigh")]
26-
public double EstimatedEbitdaHigh { get; set; }
26+
public double? EstimatedEbitdaHigh { get; set; }
2727

2828
[JsonPropertyName("estimatedEbitdaAvg")]
29-
public double EstimatedEbitdaAvg { get; set; }
29+
public double? EstimatedEbitdaAvg { get; set; }
3030

3131
[JsonPropertyName("estimatedEbitLow")]
32-
public double EstimatedEbitLow { get; set; }
32+
public double? EstimatedEbitLow { get; set; }
3333

3434
[JsonPropertyName("estimatedEbitHigh")]
35-
public double EstimatedEbitHigh { get; set; }
35+
public double? EstimatedEbitHigh { get; set; }
3636

3737
[JsonPropertyName("estimatedEbitAvg")]
38-
public double EstimatedEbitAvg { get; set; }
38+
public double? EstimatedEbitAvg { get; set; }
3939

4040
[JsonPropertyName("estimatedNetIncomeLow")]
41-
public double EstimatedNetIncomeLow { get; set; }
41+
public double? EstimatedNetIncomeLow { get; set; }
4242

4343
[JsonPropertyName("estimatedNetIncomeHigh")]
44-
public double EstimatedNetIncomeHigh { get; set; }
44+
public double? EstimatedNetIncomeHigh { get; set; }
4545

4646
[JsonPropertyName("estimatedNetIncomeAvg")]
47-
public double EstimatedNetIncomeAvg { get; set; }
47+
public double? EstimatedNetIncomeAvg { get; set; }
4848

4949
[JsonPropertyName("estimatedSgaExpenseLow")]
50-
public double EstimatedSgaExpenseLow { get; set; }
50+
public double? EstimatedSgaExpenseLow { get; set; }
5151

5252
[JsonPropertyName("estimatedSgaExpenseHigh")]
53-
public double EstimatedSgaExpenseHigh { get; set; }
53+
public double? EstimatedSgaExpenseHigh { get; set; }
5454

5555
[JsonPropertyName("estimatedSgaExpenseAvg")]
56-
public double EstimatedSgaExpenseAvg { get; set; }
56+
public double? EstimatedSgaExpenseAvg { get; set; }
5757

5858
[JsonPropertyName("estimatedEpsAvg")]
59-
public double EstimatedEpsAvg { get; set; }
59+
public double? EstimatedEpsAvg { get; set; }
6060

6161
[JsonPropertyName("estimatedEpsHigh")]
62-
public double EstimatedEpsHigh { get; set; }
62+
public double? EstimatedEpsHigh { get; set; }
6363

6464
[JsonPropertyName("estimatedEpsLow")]
65-
public double EstimatedEpsLow { get; set; }
65+
public double? EstimatedEpsLow { get; set; }
6666

6767
[JsonPropertyName("numberAnalystEstimatedRevenue")]
6868
public int NumberAnalystEstimatedRevenue { get; set; }

Tests/Statistics/StockStatisticsTests.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,23 @@ public StockStatisticsTests(ITestOutputHelper testOutput) : base(testOutput)
1616
api = ServiceProvider.GetRequiredService<IStockStatisticsProvider>();
1717
}
1818

19-
[Fact]
20-
public async Task GetAnalystEstimatesAsyncAnnualy()
19+
[Theory]
20+
[InlineData("AAPL", 10)]
21+
[InlineData("SHUR.BR", 10)]
22+
public async Task GetAnalystEstimatesAsyncAnnualy(string ticker, int limit = 1)
2123
{
22-
var result = await api.GetAnalystEstimatesAsync("AAPL", Period.Annual, limit: 1);
24+
var result = await api.GetAnalystEstimatesAsync(ticker, Period.Annual, limit: limit);
2325

2426
result.AssertNoErrors();
2527
Assert.NotEmpty(result.Data);
2628
}
2729

28-
[Fact]
29-
public async Task GetAnalystEstimatesAsyncQuarterly()
30+
[Theory]
31+
[InlineData("AAPL", 10)]
32+
[InlineData("SHUR.BR", 10)]
33+
public async Task GetAnalystEstimatesAsyncQuarterly(string ticker, int limit = 1)
3034
{
31-
var result = await api.GetAnalystEstimatesAsync("AAPL", Period.Quarter, limit: 1);
35+
var result = await api.GetAnalystEstimatesAsync(ticker, Period.Quarter, limit: limit);
3236

3337
result.AssertNoErrors();
3438
Assert.NotEmpty(result.Data);

0 commit comments

Comments
 (0)