diff --git a/Profiles/ProfileTests/EllipseHollowTests.cs b/Profiles/ProfileTests/EllipseHollowTests.cs index 9ab310f..81dd6a1 100644 --- a/Profiles/ProfileTests/EllipseHollowTests.cs +++ b/Profiles/ProfileTests/EllipseHollowTests.cs @@ -17,7 +17,7 @@ public void CreateProfileTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IEllipseHollow prfl = new EllipseHollow(h, w, thk); + IEllipseHollow prfl = new EllipseHollow(w, h, thk); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -34,7 +34,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IEllipseHollow prfl = new EllipseHollow(h, w, thk); + IEllipseHollow prfl = new EllipseHollow(w, h, thk); string json = prfl.ToJson(); IEllipseHollow prflDeserialized = json.FromJson(); @@ -53,7 +53,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IEllipseHollow prfl = new EllipseHollow(h, w, thk); + IEllipseHollow prfl = new EllipseHollow(w, h, thk); string json = prfl.ToJson(); IEllipseHollow prflDeserialized = json.FromJson(); @@ -72,7 +72,7 @@ public void GetPerimeterTest() var thk = new Length(14.3, LengthUnit.Millimeter); // Act - IEllipseHollow prfl = new EllipseHollow(h, w, thk); + IEllipseHollow prfl = new EllipseHollow(w, h, thk); IPerimeter perimeter = new Perimeter(prfl, 57); // Assert diff --git a/Profiles/ProfileTests/EllipseTests.cs b/Profiles/ProfileTests/EllipseTests.cs index 7eaf474..32136fc 100644 --- a/Profiles/ProfileTests/EllipseTests.cs +++ b/Profiles/ProfileTests/EllipseTests.cs @@ -16,7 +16,7 @@ public void CreateProfileTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IEllipse prfl = new Ellipse(h, w); + IEllipse prfl = new Ellipse(w, h); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -31,7 +31,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IEllipse prfl = new Ellipse(h, w); + IEllipse prfl = new Ellipse(w, h); string json = prfl.ToJson(); IEllipse prflDeserialized = json.FromJson(); @@ -48,7 +48,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IEllipse prfl = new Ellipse(h, w); + IEllipse prfl = new Ellipse(w, h); string json = prfl.ToJson(); IEllipse prflDeserialized = json.FromJson(); @@ -65,7 +65,7 @@ public void GetPerimeterTest() var w = new Length(18, LengthUnit.Centimeter); // Act - IEllipse prfl = new Ellipse(h, w); + IEllipse prfl = new Ellipse(w, h); IPerimeter perimeter = new Perimeter(prfl, 57); // Assert diff --git a/Profiles/ProfileTests/IParallelFlangeTests.cs b/Profiles/ProfileTests/IParallelFlangeTests.cs index 896a96b..65739cd 100644 --- a/Profiles/ProfileTests/IParallelFlangeTests.cs +++ b/Profiles/ProfileTests/IParallelFlangeTests.cs @@ -1,4 +1,6 @@ using MagmaWorks.Taxonomy.Profiles; +using OasysUnits; +using OasysUnits.Units; using ProfileTests.Utility; namespace ProfileTests @@ -120,5 +122,131 @@ public void GetPerimeterTest() TestUtility.TestListsOfDoublesAreEqual(expectedU, u); TestUtility.TestListsOfDoublesAreEqual(expectedV, v); } + + [Fact] + public void GetPerimeterMockTest() + { + // Assemble + IIParallelFlange prfl = new MockHEB500(); + + // Act + IPerimeter perimeter = new Perimeter(prfl); + + // Assert + Assert.Equal(45, perimeter.OuterEdge.Points.Count); + List u = perimeter.OuterEdge.Points.Select(x => x.Y.Millimeters).ToList(); + List v = perimeter.OuterEdge.Points.Select(x => x.Z.Millimeters).ToList(); + + var expectedU = new List() + { + -150, +150, +150, +34.25, +28.982561305564538, +23.917547326142575, +19.249603708470747, +15.158116907963219, +11.800320467831277, +9.305252622195258, +7.76879742911278, +7.25, +7.25, +7.76879742911278, +9.305252622195255, +11.800320467831273, +15.158116907963212, +19.24960370847074, +23.91754732614256, +28.982561305564527, +34.24999999999999, +150, +150, +-150, +-150, +-34.25000000000001, +-28.982561305564538, +-23.917547326142568, +-19.24960370847075, +-15.158116907963223, +-11.800320467831277, +-9.305252622195265, +-7.76879742911278, +-7.25, +-7.25, +-7.76879742911278, +-9.305252622195258, +-11.800320467831277, +-15.158116907963215, +-19.249603708470737, +-23.917547326142575, +-28.982561305564534, +-34.25, +-150, +-150 +}; + + var expectedV = new List() { + 250, +250, +222, +222, +221.4812025708872, +219.94474737780473, +217.44967953216872, +214.0918830920368, +210.00039629152926, +205.33245267385743, +200.26743869443547, +195, +-195, +-200.26743869443547, +-205.33245267385743, +-210.00039629152926, +-214.09188309203677, +-217.44967953216872, +-219.94474737780473, +-221.4812025708872, +-222, +-222, +-250, +-250, +-222, +-222, +-221.4812025708872, +-219.94474737780473, +-217.44967953216872, +-214.0918830920368, +-210.00039629152926, +-205.33245267385743, +-200.26743869443547, +-195, +195, +200.26743869443547, +205.33245267385743, +210.00039629152926, +214.0918830920368, +217.44967953216872, +219.94474737780473, +221.4812025708872, +222, +222, +250 +}; + + TestUtility.TestListsOfDoublesAreEqual(expectedU, u); + TestUtility.TestListsOfDoublesAreEqual(expectedV, v); + } + } + + public class MockHEB500 : IIParallelFlange + { + public Length FilletRadius => new Length(27, LengthUnit.Millimeter); + public Length Height => new Length(500, LengthUnit.Millimeter); + public Length Width => new Length(300, LengthUnit.Millimeter); + public Length FlangeThickness => new Length(28, LengthUnit.Millimeter); + public Length WebThickness => new Length(14.5, LengthUnit.Millimeter); + + public MockHEB500() { } } } diff --git a/Profiles/ProfileTests/RectangleTests.cs b/Profiles/ProfileTests/RectangleTests.cs index d174659..0807f20 100644 --- a/Profiles/ProfileTests/RectangleTests.cs +++ b/Profiles/ProfileTests/RectangleTests.cs @@ -16,7 +16,7 @@ public void CreateProfileTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IRectangle prfl = new Rectangle(h, w); + IRectangle prfl = new Rectangle(w, h); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -31,7 +31,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IRectangle prfl = new Rectangle(h, w); + IRectangle prfl = new Rectangle(w, h); string json = prfl.ToJson(); IRectangle prflDeserialized = json.FromJson(); @@ -48,7 +48,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var w = new Length(5.4, LengthUnit.Centimeter); // Act - IRectangle prfl = new Rectangle(h, w); + IRectangle prfl = new Rectangle(w, h); string json = prfl.ToJson(); IRectangle prflDeserialized = json.FromJson(); @@ -65,7 +65,7 @@ public void GetPerimeterTest() var w = new Length(50.4, LengthUnit.Centimeter); // Act - IRectangle prfl = new Rectangle(h, w); + IRectangle prfl = new Rectangle(w, h); IPerimeter perimeter = new Perimeter(prfl); // Assert diff --git a/Profiles/ProfileTests/RectangularHollowTests.cs b/Profiles/ProfileTests/RectangularHollowTests.cs index e059a0a..be4545f 100644 --- a/Profiles/ProfileTests/RectangularHollowTests.cs +++ b/Profiles/ProfileTests/RectangularHollowTests.cs @@ -17,7 +17,7 @@ public void CreateProfileTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IRectangularHollow prfl = new RectangularHollow(h, w, thk); + IRectangularHollow prfl = new RectangularHollow(w, h, thk); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -34,7 +34,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IRectangularHollow prfl = new RectangularHollow(h, w, thk); + IRectangularHollow prfl = new RectangularHollow(w, h, thk); string json = prfl.ToJson(); IRectangularHollow prflDeserialized = json.FromJson(); @@ -53,7 +53,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IRectangularHollow prfl = new RectangularHollow(h, w, thk); + IRectangularHollow prfl = new RectangularHollow(w, h, thk); string json = prfl.ToJson(); IRectangularHollow prflDeserialized = json.FromJson(); @@ -72,7 +72,7 @@ public void GetPerimeterTest() var thk = new Length(10.9, LengthUnit.Millimeter); // Act - IRectangularHollow prfl = new RectangularHollow(h, w, thk); + IRectangularHollow prfl = new RectangularHollow(w, h, thk); IPerimeter perimeter = new Perimeter(prfl); // Assert diff --git a/Profiles/ProfileTests/RoundedRectangleTests.cs b/Profiles/ProfileTests/RoundedRectangleTests.cs index 2658fef..caab461 100644 --- a/Profiles/ProfileTests/RoundedRectangleTests.cs +++ b/Profiles/ProfileTests/RoundedRectangleTests.cs @@ -18,7 +18,7 @@ public void CreateProfileTest() var w1 = new Length(4, LengthUnit.Centimeter); // Act - IRoundedRectangle prfl = new RoundedRectangle(h, w, h1, w1); + IRoundedRectangle prfl = new RoundedRectangle(w, h, w1, h1); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -37,7 +37,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var w1 = new Length(4, LengthUnit.Centimeter); // Act - IRoundedRectangle prfl = new RoundedRectangle(h, w, h1, w1); + IRoundedRectangle prfl = new RoundedRectangle(w, h, w1, h1); string json = prfl.ToJson(); IRoundedRectangle prflDeserialized = json.FromJson(); @@ -58,7 +58,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var w1 = new Length(4, LengthUnit.Centimeter); // Act - IRoundedRectangle prfl = new RoundedRectangle(h, w, h1, w1); + IRoundedRectangle prfl = new RoundedRectangle(w, h, w1, h1); string json = prfl.ToJson(); IRoundedRectangle prflDeserialized = json.FromJson(); @@ -79,7 +79,7 @@ public void GetPerimeterTest() var w1 = new Length(10, LengthUnit.Centimeter); // Act - IRoundedRectangle prfl = new RoundedRectangle(h, w, h1, w1); + IRoundedRectangle prfl = new RoundedRectangle(w, h, w1, h1); IPerimeter perimeter = new Perimeter(prfl); // Assert diff --git a/Profiles/ProfileTests/RoundedRectangularHollowTests.cs b/Profiles/ProfileTests/RoundedRectangularHollowTests.cs index d14583c..d5fb2a6 100644 --- a/Profiles/ProfileTests/RoundedRectangularHollowTests.cs +++ b/Profiles/ProfileTests/RoundedRectangularHollowTests.cs @@ -19,7 +19,7 @@ public void CreateProfileTest() var thk = new Length(3.8, LengthUnit.Millimeter); // Act - IRoundedRectangularHollow prfl = new RoundedRectangularHollow(h, w, h1, w1, thk); + IRoundedRectangularHollow prfl = new RoundedRectangularHollow(w, h, w1, h1, thk); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -40,7 +40,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var thk = new Length(3.8, LengthUnit.Millimeter); // Act - IRoundedRectangularHollow prfl = new RoundedRectangularHollow(h, w, h1, w1, thk); + IRoundedRectangularHollow prfl = new RoundedRectangularHollow(w, h, w1, h1, thk); string json = prfl.ToJson(); IRoundedRectangularHollow prflDeserialized = json.FromJson(); @@ -63,7 +63,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var thk = new Length(3.8, LengthUnit.Millimeter); // Act - IRoundedRectangularHollow prfl = new RoundedRectangularHollow(h, w, h1, w1, thk); + IRoundedRectangularHollow prfl = new RoundedRectangularHollow(w, h, w1, h1, thk); string json = prfl.ToJson(); IRoundedRectangularHollow prflDeserialized = json.FromJson(); @@ -86,7 +86,7 @@ public void GetPerimeterTest() var thk = new Length(5.5, LengthUnit.Millimeter); // Act - IRoundedRectangularHollow prfl = new RoundedRectangularHollow(h, w, h1, w1, thk); + IRoundedRectangularHollow prfl = new RoundedRectangularHollow(w, h, w1, h1, thk); IPerimeter perimeter = new Perimeter(prfl); // Assert diff --git a/Profiles/ProfileTests/TrapezoidTests.cs b/Profiles/ProfileTests/TrapezoidTests.cs index b40cdb7..3413f1c 100644 --- a/Profiles/ProfileTests/TrapezoidTests.cs +++ b/Profiles/ProfileTests/TrapezoidTests.cs @@ -17,7 +17,7 @@ public void CreateProfileTest() var wBottom = new Length(0.5, LengthUnit.Meter); // Act - ITrapezoid prfl = new Trapezoid(h, wTop, wBottom); + ITrapezoid prfl = new Trapezoid(wTop, wBottom, h); // Assert TestUtility.TestLengthsAreEqual(h, prfl.Height); @@ -34,7 +34,7 @@ public void InterfaceSurvivesRoundtripDeserializationTest() var wBottom = new Length(0.5, LengthUnit.Meter); // Act - ITrapezoid prfl = new Trapezoid(h, wTop, wBottom); + ITrapezoid prfl = new Trapezoid(wTop, wBottom, h); string json = prfl.ToJson(); ITrapezoid prflDeserialized = json.FromJson(); @@ -53,7 +53,7 @@ public void ConcreteImplementationSurvivesRoundtripDeserializationTest() var wBottom = new Length(0.5, LengthUnit.Meter); // Act - ITrapezoid prfl = new Trapezoid(h, wTop, wBottom); + ITrapezoid prfl = new Trapezoid(wTop, wBottom, h); string json = prfl.ToJson(); ITrapezoid prflDeserialized = json.FromJson(); @@ -72,7 +72,7 @@ public void GetPerimeterTest() var wBottom = new Length(0.5, LengthUnit.Meter); // Act - ITrapezoid prfl = new Trapezoid(h, wTop, wBottom); + ITrapezoid prfl = new Trapezoid(wTop, wBottom, h); IPerimeter perimeter = new Perimeter(prfl); // Assert diff --git a/Profiles/Profiles/Ellipse.cs b/Profiles/Profiles/Ellipse.cs index 1d6a174..aab2102 100644 --- a/Profiles/Profiles/Ellipse.cs +++ b/Profiles/Profiles/Ellipse.cs @@ -7,7 +7,7 @@ public class Ellipse : IEllipse public Length Height { get; set; } public Length Width { get; set; } - public Ellipse(Length height, Length width) + public Ellipse(Length width, Length height) { Height = height; Width = width; diff --git a/Profiles/Profiles/EllipseHollow.cs b/Profiles/Profiles/EllipseHollow.cs index 6b82288..8b5fb09 100644 --- a/Profiles/Profiles/EllipseHollow.cs +++ b/Profiles/Profiles/EllipseHollow.cs @@ -8,7 +8,7 @@ public class EllipseHollow : IEllipseHollow public Length Width { get; set; } public Length Thickness { get; set; } - public EllipseHollow(Length height, Length width, Length thickness) + public EllipseHollow(Length width, Length height, Length thickness) { Height = height; Width = width; diff --git a/Profiles/Profiles/Rectangle.cs b/Profiles/Profiles/Rectangle.cs index 80ccc8c..c0a3c87 100644 --- a/Profiles/Profiles/Rectangle.cs +++ b/Profiles/Profiles/Rectangle.cs @@ -7,7 +7,7 @@ public class Rectangle : IRectangle public Length Height { get; set; } public Length Width { get; set; } - public Rectangle(Length height, Length width) + public Rectangle(Length width, Length height) { Height = height; Width = width; diff --git a/Profiles/Profiles/RectangularHollow.cs b/Profiles/Profiles/RectangularHollow.cs index b2f7a79..a35f390 100644 --- a/Profiles/Profiles/RectangularHollow.cs +++ b/Profiles/Profiles/RectangularHollow.cs @@ -8,7 +8,7 @@ public class RectangularHollow : IRectangularHollow public Length Width { get; set; } public Length Thickness { get; set; } - public RectangularHollow(Length height, Length width, Length thickness) + public RectangularHollow(Length width, Length height, Length thickness) { Height = height; Width = width; diff --git a/Profiles/Profiles/RoundedRectangle.cs b/Profiles/Profiles/RoundedRectangle.cs index d9f6fc6..4500d1e 100644 --- a/Profiles/Profiles/RoundedRectangle.cs +++ b/Profiles/Profiles/RoundedRectangle.cs @@ -9,7 +9,7 @@ public class RoundedRectangle : IRoundedRectangle public Length FlatHeight { get; set; } public Length FlatWidth { get; set; } - public RoundedRectangle(Length height, Length width, Length flatHeight, Length flatWidth) + public RoundedRectangle(Length width, Length height, Length flatWidth, Length flatHeight) { Height = height; Width = width; diff --git a/Profiles/Profiles/RoundedRectangularHollow.cs b/Profiles/Profiles/RoundedRectangularHollow.cs index dac5f50..1e9de4b 100644 --- a/Profiles/Profiles/RoundedRectangularHollow.cs +++ b/Profiles/Profiles/RoundedRectangularHollow.cs @@ -10,7 +10,7 @@ public class RoundedRectangularHollow : IRoundedRectangularHollow public Length FlatWidth { get; set; } public Length Thickness { get; set; } - public RoundedRectangularHollow(Length height, Length width, Length flatHeight, Length flatWidth, Length thickness) + public RoundedRectangularHollow(Length width, Length height, Length flatWidth, Length flatHeight, Length thickness) { Height = height; Width = width; diff --git a/Profiles/Profiles/Trapezoid.cs b/Profiles/Profiles/Trapezoid.cs index ae4a963..d9cb654 100644 --- a/Profiles/Profiles/Trapezoid.cs +++ b/Profiles/Profiles/Trapezoid.cs @@ -8,7 +8,7 @@ public class Trapezoid : ITrapezoid public Length TopWidth { get; set; } public Length BottomWidth { get; set; } - public Trapezoid(Length height, Length topWidth, Length bottomWidth) + public Trapezoid(Length topWidth, Length bottomWidth, Length height) { Height = height; TopWidth = topWidth;