Skip to content

Commit

Permalink
GSAGH-499: add missing test
Browse files Browse the repository at this point in the history
  • Loading branch information
SandeepArup committed Feb 3, 2025
1 parent c18777e commit 1518c3e
Showing 1 changed file with 50 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public void ComponentShouldReturnCorrectUpperFrequency() {
}

[Fact]
public void ComponentShouldReportErrorFrequenciesAreNotCorrect() {
public void ComponentShouldReportErrorIfFrequenciesAreNotCorrect() {
SetFrequency(6, 5);
ComponentTestHelper.ComputeOutput(_component);
Assert.Equal(2, _component.RuntimeMessages(GH_RuntimeMessageLevel.Error).Count);
Expand Down Expand Up @@ -342,7 +342,11 @@ public CreateModalDynamicParameterByTargetMassParticipationTest(ModalMassOption
PrepareComponent(massOption, direction);
}


private void SetTargetMas(double x, double y, double z) {
ComponentTestHelper.SetInput(_component, x, 0);
ComponentTestHelper.SetInput(_component, y, 1);
ComponentTestHelper.SetInput(_component, z, 2);
}
private void PrepareComponent(ModalMassOption massOption, Direction direction) {
_component = ComponentMother(massOption, direction);
var _modalDynamicAnalysisGoo = (GsaModalDynamicGoo)ComponentTestHelper.GetOutput(_component);
Expand Down Expand Up @@ -398,8 +402,45 @@ public static GH_OasysComponent ComponentMother(ModalMassOption massOption, Dire
}

[Fact]
public void ComponentShouldReturnCorrectNumberOfLimitingMode() {
Assert.Equal(10, _modeCalculationStrategy.MaximumNumberOfModes);
public void ComponentShouldReportErrorIfTargetMassFactorLessThanZeroInXDirection() {
SetTargetMas(-1, 100, 100);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
public void ComponentShouldReportErrorIfTargetMassFactorGreaterThan100InXDirection() {
SetTargetMas(101, 100, 100);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
public void ComponentShouldReportErrorIfTargetMassFactorLessThanZeroInYDirection() {
SetTargetMas(100, -1, 100);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
public void ComponentShouldReportErrorIfTargetMassFactorGreaterThan100InYDirection() {
SetTargetMas(100, 101, 100);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
public void ComponentShouldReportErrorIfTargetMassFactorLessThanZeroInZDirection() {
SetTargetMas(100, 100, -1);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
public void ComponentShouldReportErrorIfTargetMassFactorGreaterThan100InZDirection() {
SetTargetMas(100, 100, 101);
ComponentTestHelper.ComputeOutput(_component);
Assert.Single(_component.RuntimeMessages(GH_RuntimeMessageLevel.Error));
}

[Fact]
Expand All @@ -417,6 +458,11 @@ public void ComponentShouldReturnCorrectZDirectionParticipation() {
Assert.Equal(100, _modeCalculationStrategy.TargetMassInZDirection);
}

[Fact]
public void ComponentShouldReturnCorrectNumberOfLimitingMode() {
Assert.Equal(10, _modeCalculationStrategy.MaximumNumberOfModes);
}

[Fact]
public void ComponentShouldReturnCorrectMASILOption() {
Assert.True(_modeCalculationStrategy.SkipModesWithLowMassParticipation);
Expand Down

0 comments on commit 1518c3e

Please sign in to comment.