gpt4 book ai didi

c# - 与 IndexOutOfRangeException 相关的问题

转载 作者:太空宇宙 更新时间:2023-11-03 22:11:00 26 4
gpt4 key购买 nike

<分区>

我在我的 C# 代码中收到 IndexOutOfRangeException 的连续错误。代码片段如下:

public void GetAccountSalesDataTestWithAccountsIncluded()
{
AccountSalesDataRepository target = new AccountSalesDataRepository();
AccountSalesDataSearchCriteria[] searchCriteria = new AccountSalesDataSearchCriteria[2]
{
new AccountSalesDataSearchCriteria
{
ProgramAccountId = new AccountSalesDataSearchCriteria.SearchCriteria<int>[1] { new AccountSalesDataSearchCriteria.SearchCriteria<int>(98, true) }
},
new AccountSalesDataSearchCriteria()
};

AccountSalesDataSummary[] results;
results = target.GetAggregateAccountSalesData(searchCriteria, true);
try
{
Assert.IsNotNull(results, "The result set should not be null with the given account");
Assert.IsTrue(results.Length > 0, "The result set should not be empty with given account");
}
catch (AssertFailedException /*ex*/)
{
}
this.AccountSalesDataSummaryBasicTest(results, true);
try
{
Assert.AreEqual(results[0].AccountId, 2);
Assert.AreEqual(results[0].TotalPurchaseAmount, decimal.Parse("200"), "The total purchase amount is incorrect");
Assert.AreEqual(results[0].TotalPurchaseQuantity, 2000, "The total purchase quantity is incorrect");
Assert.AreEqual(results[0].TotalSaleQuantity, double.Parse("200"), "The total sales quantity is incorrect");
Assert.AreEqual(results[0].TotalSalesAmount, decimal.Parse("20"), "The total sales amount is incorrect");
}
catch (AssertFailedException /*ex*/)
{
}
}

这可能是什么原因?

如果我可能会说我与我的概念不一致,请原谅我,因为我对这整件事真的很陌生。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com