Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
Use [Theory].
Browse files Browse the repository at this point in the history
  • Loading branch information
keiji committed Jan 12, 2022
1 parent 8001160 commit 1b8d799
Showing 1 changed file with 6 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ private IExposureRiskCalculationService CreateService()
return new ExposureRiskCalculationService();
}

[Fact]
public void LowRiskExposureTest()
[Theory]
[InlineData(1999, RiskLevel.Low)]
[InlineData(2000, RiskLevel.High)]
public void RiskExposureTest(double scoreSum, RiskLevel expected)
{

var dailySummary = new DailySummary()
{
DateMillisSinceEpoch = 0,
DaySummary = new ExposureSummaryData()
{
ScoreSum = 1999.0
ScoreSum = scoreSum
},
ConfirmedClinicalDiagnosisSummary = new ExposureSummaryData(),
ConfirmedTestSummary = new ExposureSummaryData(),
Expand All @@ -54,43 +56,7 @@ public void LowRiskExposureTest()

RiskLevel result = service.CalcRiskLevel(dailySummary, exposureWindows);

Assert.Equal(RiskLevel.Low, result);
}

[Fact]
public void HighRiskExposureTest()
{

var dailySummary = new DailySummary()
{
DateMillisSinceEpoch = 0,
DaySummary = new ExposureSummaryData()
{
ScoreSum = 2000.0
},
ConfirmedClinicalDiagnosisSummary = new ExposureSummaryData(),
ConfirmedTestSummary = new ExposureSummaryData(),
RecursiveSummary = new ExposureSummaryData(),
SelfReportedSummary = new ExposureSummaryData()
};

var exposureWindows = new List<ExposureWindow>()
{
new ExposureWindow()
{
CalibrationConfidence = CalibrationConfidence.High,
DateMillisSinceEpoch = 0,
Infectiousness = Infectiousness.High,
ReportType = ReportType.Unknown,
ScanInstances = new List<ScanInstance>()
}
};

IExposureRiskCalculationService service = CreateService();

RiskLevel result = service.CalcRiskLevel(dailySummary, exposureWindows);

Assert.Equal(RiskLevel.High, result);
Assert.Equal(expected, result);
}
}
}

0 comments on commit 1b8d799

Please sign in to comment.