Fixed some unit tests.

This commit is contained in:
2025-02-06 16:49:01 -05:00
parent 9347b5b5fa
commit 0a5c5a9594

View File

@@ -272,7 +272,7 @@ namespace MarketDataUnitTests
[TestMethod]
public void CompanyProfileRetrieval()
{
String symbol="MIDD";
String symbol="MOD";
CompanyProfile companyProfile=MarketDataHelper.GetCompanyProfile(symbol);
Assert.IsTrue(null!=companyProfile);
}
@@ -403,19 +403,35 @@ namespace MarketDataUnitTests
[TestMethod]
public void CashflowStatementMorningStarRetrieval()
{
String symbol="MIDD";
List<CashflowStatement> cashflowStatements = MarketDataHelper.GetCashflowStatement(symbol, CashflowStatement.PeriodType.Annual);
Assert.IsTrue(null != cashflowStatements && cashflowStatements.Count > 0);
CashflowStatement cashflowStatement = cashflowStatements[0];
Assert.IsTrue(!double.IsNaN(cashflowStatement.DepreciationAndAmortization),"DepreciationAndAmortization");
Assert.IsTrue(!double.IsNaN(cashflowStatement.DeferredIncomeTaxes),"DeferredIncomeTaxes");
Assert.IsTrue(!double.IsNaN(cashflowStatement.StockBasedCompensation),"StockBasedCompensation");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsReceivable),"AccountsReceivable");
Assert.IsTrue(!double.IsNaN(cashflowStatement.Inventory),"Inventory");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsPayable),"AccountsPayable");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccruedLiabilities),"AccruedLiabilities");
Assert.IsTrue(!double.IsNaN(cashflowStatement.OperatingCashflow),"OperatingCashflow");
Assert.IsTrue(!double.IsNaN(cashflowStatement.FreeCashflow),"FreeCashflow");
String[] symbols = {"AZEK", "CPRT", "DOCU", "ESTC", "HLNE"};
Dictionary<String,List<CashflowStatement>> cashflowStatementsDict = new Dictionary<String,List<CashflowStatement>>();
foreach(String symbol in symbols)
{
List<CashflowStatement> cashflowStatements = MarketDataHelper.GetCashflowStatement(symbol, CashflowStatement.PeriodType.Annual);
if(null == cashflowStatements)continue;
cashflowStatementsDict.Add(symbol, cashflowStatements);
}
Assert.IsTrue(cashflowStatementsDict.Count!=0,"Error retrieving cashflow statements.");
List<String> keys = cashflowStatementsDict.Keys.ToList();
foreach(String key in keys)
{
List<CashflowStatement> cashflowStatements = cashflowStatementsDict[key];
CashflowStatement cashflowStatement = cashflowStatements[0];
Assert.IsTrue(!double.IsNaN(cashflowStatement.DepreciationAndAmortization), $"DepreciationAndAmortization for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.DeferredIncomeTaxes), $"DeferredIncomeTaxes for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.StockBasedCompensation), $"StockBasedCompensation for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsReceivable), $"AccountsReceivable for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.Inventory), $"Inventory for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccountsPayable), $"AccountsPayable for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.AccruedLiabilities), $"AccruedLiabilities for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.OperatingCashflow), $"OperatingCashflow for {key}");
Assert.IsTrue(!double.IsNaN(cashflowStatement.FreeCashflow), $"FreeCashflow for {key}");
}
}
[TestMethod]