Skip to content

Commit

Permalink
Added unit tests to test specification of AbsorptionWeightingType.Ana…
Browse files Browse the repository at this point in the history
…log and the resulting exception.
  • Loading branch information
hayakawa16 committed May 2, 2024
1 parent 042d944 commit fdd6f3a
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,59 @@ public void Validate_pMC_DAW_ROfFx_nonzero_perturbation_one_layer_tissue()
Assert.AreEqual(89, postProcessedOutput.pMC_R_fx_TallyCount);
}

[Test]
public void Test_Analog_absorption_weighting_type_throws_argument_exception()
{
var test1 = new DMuaDetectorTest();
Assert.Throws<ArgumentException>(() =>
{
try
{
test1.SetAbsorbAction(AbsorptionWeightingType.Analog);
}
catch (Exception e)
{
Assert.AreEqual("Analog is not allowed with this detector (Parameter 'awt')", e.Message);
throw;
}
});
var test2 = new DMusDetectorTest();
Assert.Throws<ArgumentException>(() =>
{
try
{
test2.SetAbsorbAction(AbsorptionWeightingType.Analog);
}
catch (Exception e)
{
Assert.AreEqual("Analog is not allowed with this detector (Parameter 'awt')", e.Message);
throw;
}
});
}

/// <summary>
/// Expose protected method in a new class that inherits the class under test
/// </summary>
public class DMuaDetectorTest : dMCdROfRhodMuaDetector
{
public new void SetAbsorbAction(AbsorptionWeightingType awt)
{
base.SetAbsorbAction(awt);
}
}

/// <summary>
/// Expose protected method in a new class that inherits the class under test
/// </summary>
public class DMusDetectorTest : dMCdROfRhodMusDetector
{
public new void SetAbsorbAction(AbsorptionWeightingType awt)
{
base.SetAbsorbAction(awt);
}
}

}
}

0 comments on commit fdd6f3a

Please sign in to comment.