Add test of rebar by density and rebar by inclined rebar
This commit is contained in:
@@ -33,21 +33,107 @@ namespace StructureHelperTests.UnitTests.BeamShearTests
|
||||
);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetShearStrength_CalculatesCorrectly()
|
||||
[TestCase(0.2, 0.48)]
|
||||
[TestCase(0.5, 1.2)]
|
||||
[TestCase(1.1, 2.64)]
|
||||
[TestCase(2.2, 2.64)]
|
||||
public void GetShearStrength_CalculatesCorrectly_differentStirrupEnd(double stirrupEnd, double expectedStrength)
|
||||
{
|
||||
// Arrange
|
||||
_mockInclinedSection.Setup(s => s.StartCoord).Returns(1.0);
|
||||
_mockInclinedSection.Setup(s => s.EndCoord).Returns(3.0);
|
||||
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(2.0);
|
||||
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
|
||||
_mockInclinedSection.Setup(s => s.EndCoord).Returns(100);
|
||||
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
|
||||
|
||||
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(0.5);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(1.2);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(1.1);
|
||||
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
|
||||
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
|
||||
|
||||
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
|
||||
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
|
||||
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(stirrupEnd);
|
||||
|
||||
double expectedStrength = 1.2 * 1.1 * 1.0 * 4.0; // Min(2.0, 1.0) = 1.0
|
||||
// Act
|
||||
double result = _beamShearStrength.GetShearStrength();
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
|
||||
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
|
||||
}
|
||||
|
||||
[TestCase(0.20, 0.48)]
|
||||
[TestCase(0.55, 1.32)]
|
||||
[TestCase(1.1, 2.64)]
|
||||
[TestCase(2.2, 2.64)]
|
||||
public void GetShearStrength_CalculatesCorrectly_differentInclinedSectionEnd(double inclinedSectionEnd, double expectedStrength)
|
||||
{
|
||||
// Arrange
|
||||
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
|
||||
_mockInclinedSection.Setup(s => s.EndCoord).Returns(inclinedSectionEnd);
|
||||
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
|
||||
|
||||
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
|
||||
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
|
||||
|
||||
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
|
||||
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
|
||||
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
|
||||
|
||||
// Act
|
||||
double result = _beamShearStrength.GetShearStrength();
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
|
||||
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
|
||||
}
|
||||
|
||||
[TestCase(0.2, 0.66)]
|
||||
[TestCase(0.5, 1.65)]
|
||||
[TestCase(0.8, 2.64)]
|
||||
public void GetShearStrength_CalculatesCorrectly_differentShapeFactor(double shapeFactor, double expectedStrength)
|
||||
{
|
||||
// Arrange
|
||||
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
|
||||
_mockInclinedSection.Setup(s => s.EndCoord).Returns(1.1);
|
||||
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
|
||||
|
||||
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(shapeFactor);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(0.75);
|
||||
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
|
||||
|
||||
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
|
||||
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
|
||||
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
|
||||
|
||||
// Act
|
||||
double result = _beamShearStrength.GetShearStrength();
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.EqualTo(expectedStrength).Within(1e-6));
|
||||
_mockTraceLogger.Verify(t => t.AddMessage(It.IsAny<string>(), It.IsAny<TraceLogStatuses>()), Times.AtLeastOnce);
|
||||
}
|
||||
|
||||
[TestCase(0.2, 0.704)]
|
||||
[TestCase(0.5, 1.76)]
|
||||
[TestCase(0.8, 2.816)]
|
||||
public void GetShearStrength_CalculatesCorrectly_differentPlacementFactor(double placementFactor, double expectedStrength)
|
||||
{
|
||||
// Arrange
|
||||
_mockInclinedSection.Setup(s => s.StartCoord).Returns(0);
|
||||
_mockInclinedSection.Setup(s => s.EndCoord).Returns(1.1);
|
||||
_mockInclinedSection.Setup(s => s.EffectiveDepth).Returns(0.55);
|
||||
|
||||
_mockStirrupEffectiveness.Setup(s => s.MaxCrackLengthRatio).Returns(2.0);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupShapeFactor).Returns(0.8);
|
||||
_mockStirrupEffectiveness.Setup(s => s.StirrupPlacementFactor).Returns(placementFactor);
|
||||
_mockStirrupEffectiveness.Setup(s => s.MinimumStirrupRatio).Returns(0.25);
|
||||
|
||||
_mockStirrupByDensity.Setup(s => s.StirrupDensity).Returns(4.0);
|
||||
_mockStirrupByDensity.Setup(s => s.StartCoordinate).Returns(0);
|
||||
_mockStirrupByDensity.Setup(s => s.EndCoordinate).Returns(100);
|
||||
|
||||
// Act
|
||||
double result = _beamShearStrength.GetShearStrength();
|
||||
|
||||
@@ -3,6 +3,7 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using StructureHelperCommon.Infrastructures.Enums;
|
||||
using StructureHelperCommon.Models.Materials;
|
||||
using StructureHelperCommon.Models.Shapes;
|
||||
using StructureHelperLogics.Models.BeamShears;
|
||||
using StructureHelperLogics.Models.Materials;
|
||||
using System;
|
||||
@@ -36,6 +37,7 @@ namespace StructureHelperTests.UnitTests.BeamShearTests
|
||||
mockSection.Setup(s => s.ConcreteMaterial).Returns(mockConcreteMaterial.Object);
|
||||
mockSection.Setup(s => s.ReinforcementMaterial).Returns(mockReinforcementMaterial.Object);
|
||||
mockSection.Setup(s => s.ReinforcementArea).Returns(reinforcementArea);
|
||||
mockSection.Setup(s => s.Shape).Returns(new RectangleShape(){ Width = 1, Height =2 });
|
||||
|
||||
var mockInclSection = new Mock<IInclinedSection>();
|
||||
mockInclSection.Setup(s => s.WebWidth).Returns(width);
|
||||
|
||||
Reference in New Issue
Block a user