Skip to content

Commit

Permalink
Removed unused usings. Wrote more unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hayakawa16 committed Aug 23, 2024
1 parent db40c98 commit 648b186
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ namespace Vts.Test.MonteCarlo.DataStructuresValidation
[TestFixture]
public class SimulationInputValidationTests
{
/// <summary>
/// Test to verify input with source initial tissue region index outside number
/// of tissue regions is invalid
/// </summary>
[Test]
public void Validate_source_with_initial_tissue_region_index_outside_tissue_range_invalid()
{
// generate input without source initial tissue region in error
var input = new SimulationInput() // default constructor has empty list of databases
{
SourceInput = new CustomPointSourceInput { InitialTissueRegionIndex = 100 }
};
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}

/// <summary>
/// Test to verify input with no detectors nor database specified is invalid
/// </summary>
Expand Down Expand Up @@ -174,6 +190,23 @@ public void Validate_voxel_tissue_and_cylindrical_detectors_issues_warning()
Assert.That(output.ToString(), Is.EqualTo("Warning: voxel in tissue with cylindrical detector defined: user discretion advised\r\n"));
}

/// <summary>
/// Test to verify input with bounded tissue without ATotalBoundingVolume detector
/// is invalid
/// </summary>
[Test]
public void Validate_bounded_tissue_without_ATotalBoundingVolume_detector_invalid()
{
// generate input with bounding cylinder tissue without needed detector
var input = new SimulationInput
{
TissueInput = new BoundingCylinderTissueInput(),
DetectorInputs = new List<IDetectorInput> { new ROfRhoDetectorInput() }
};
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsFalse(result.IsValid);
}

/// <summary>
/// Test to verify input with angled source and cylindrical detectors outputs warning
/// but continues as valid input
Expand Down Expand Up @@ -207,7 +240,7 @@ public void Validate_transmittance_detector_with_final_tissue_region_equal_0_is_
var input = new SimulationInput
{
DetectorInputs = new List<IDetectorInput> {
new TOfRhoDetectorInput()
new TOfRhoDetectorInput
{
FinalTissueRegionIndex = 0
}
Expand Down Expand Up @@ -269,7 +302,6 @@ public void Validate_voxel_tissue_and_ROfFx_detectors_defined_together_issues_wa
var result = SimulationInputValidation.ValidateInput(input);
Assert.IsTrue(result.IsValid); // only warning
Assert.That(output.ToString(), Is.EqualTo("Warning: R(fx) theory assumes a homogeneous or layered tissue geometry: user discretion advised\r\n"));

}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using Vts.Common;
using Vts.MonteCarlo.DataStructuresValidation;
using Vts.MonteCarlo.Detectors;
using Vts.MonteCarlo.Sources;
using Vts.MonteCarlo.Tissues;

Expand Down

0 comments on commit 648b186

Please sign in to comment.