0
reportFilePathを変数に設定しているときに返されるすべてのデータセットに対して1番目と2番目のテストを実行したい毎回。私はそれだけで一つのテストを作ることができますが、私はここで C#Nunit - yieldデータを返すときに2つのテストを並行して実行する
private string reportFilePath;
[Test]
[TestCaseSource(typeof(TestData.SwiftReporting), "GenerateDailyLargeExposureReport")]
[Order(4)]
public async Task ShouldGenerateDailyLargeExposureReport(int year, int month, int day)
{
ReportResponseModel dailyLargeExposureReport = new ReportResponseModel();
DateTime date = new DateTime(year, month, day).Date;
string formattedDate = date.ToString("d");
dailyLargeExposureReport = await ReportLogic.RequestReport(date, (int)ReportsEnum.DailyLargeExposureReport, null, AuthToken);
dailyLargeExposureReport.Should().NotBeNull();
reportFilePath = dailyLargeExposureReport.FilePath;
}
[Test]
[TestCaseSource(typeof(TestData.SwiftReporting), "DownloadDailyLargeExposureReport")]
[Order(8)]
public async Task ShouldDownloadDailyLargeExposureReport(int accountCount)
{
DailyLargeExposureReportModel outputReport = new DailyLargeExposureReportModel();
outputReport = (DailyLargeExposureReportModel)await ReportLogic.DownloadReport(reportFilePath, ReportsEnum.DailyLargeExposureReport, AuthToken);
List<DailyLargeExposureAccountModel> reportAccounts = outputReport.Accounts;
reportAccounts.Count().Should().Be(7);
}
が私のデータである大きすぎるのthatsを考える:それから、
public static IEnumerable<TestCaseData> GenerateDailyLargeExposureReport
{
get
{
yield return new TestCaseData(2017, 1, 2)
.SetName("Generate DLE report for Account1, Jan 2");
yield return new TestCaseData(2017, 1, 3)
.SetName("Generate DLE report for Account1, Jan 3");
}
}
public static IEnumerable<TestCaseData> DownloadDailyLargeExposureReport
{
get
{
yield return new TestCaseData(3)
.SetName("Get data for Account1, Jan 2");
yield return new TestCaseData(5)
.SetName("Get data for Account1, Jan 3");
}
}
は、だから私は、それぞれのIEnumerableにデータの最初のセットのための両方のテストを実行したいです2番目のセットでもう一度やり直してください。