-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e76cf5
commit ac348c6
Showing
14 changed files
with
262 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 30 additions & 42 deletions
72
...erters/Revit/Speckle.Converters.Revit2023.Tests/ModelCurveArrayToSpeckleConverterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.Tests/ArcToSpeckleConverterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using FluentAssertions; | ||
using Moq; | ||
using NUnit.Framework; | ||
using Rhino; | ||
using Speckle.Converters.Common; | ||
using Speckle.Converters.Common.Objects; | ||
using Speckle.Converters.Rhino7.ToSpeckle.Raw; | ||
using Speckle.Testing; | ||
|
||
namespace Speckle.Converters.Rhino7.Tests; | ||
|
||
public class ArcToSpeckleConverterTests : MoqTest | ||
{ | ||
[Test] | ||
public void Convert_ShouldConvertArcCorrectly() | ||
{ | ||
// Arrange | ||
var radius = 1.1d; | ||
var mockPointConverter = Create<ITypedConverter<RG.Point3d, SOG.Point>>(); | ||
var mockPlaneConverter = Create<ITypedConverter<RG.Plane, SOG.Plane>>(); | ||
var mockBoxConverter = Create<ITypedConverter<RG.Box, SOG.Box>>(); | ||
var mockContextStack = Create<IConversionContextStack<RhinoDoc, UnitSystem>>(); | ||
var factory = Create<IBoxFactory>(); | ||
|
||
|
||
var context = Create<IConversionContext<RhinoDoc>>(); | ||
context.Setup(x => x.SpeckleUnits).Returns("units"); | ||
mockContextStack.Setup(cs => cs.Current).Returns(context.Object); | ||
|
||
var targetArc = Create<RG.Arc>(); | ||
var targetPlane = Create<RG.Plane>(); | ||
var targetBox = Create<RG.Box>(); | ||
var point3d = Create<RG.Point3d>(); | ||
var boundbox = Create<RG.BoundingBox>(); | ||
|
||
targetArc.Setup(x => x.Plane).Returns(targetPlane.Object); | ||
targetArc.Setup(x => x.Radius).Returns(radius); | ||
targetArc.Setup(x => x.StartAngle).Returns(radius); | ||
targetArc.Setup(x => x.EndAngle).Returns(radius); | ||
targetArc.Setup(x => x.Angle).Returns(radius); | ||
targetArc.Setup(x => x.Length).Returns(radius); | ||
targetArc.Setup(x => x.StartPoint).Returns(point3d.Object); | ||
targetArc.Setup(x => x.MidPoint).Returns(point3d.Object); | ||
targetArc.Setup(x => x.EndPoint).Returns(point3d.Object); | ||
targetArc.Setup(x => x.BoundingBox()).Returns(boundbox.Object); | ||
factory.Setup(x => x.Create(boundbox.Object)).Returns(targetBox.Object); | ||
|
||
mockPlaneConverter.Setup(pc => pc.Convert(targetPlane.Object)).Returns(new SOG.Plane()); | ||
mockPointConverter.Setup(pc => pc.Convert(It.IsAny<RG.Point3d>())).Returns(new SOG.Point()); | ||
mockBoxConverter.Setup(bc => bc.Convert(targetBox.Object)).Returns(new SOG.Box()); | ||
|
||
var converter = new ArcToSpeckleConverter( | ||
mockPointConverter.Object, | ||
mockPlaneConverter.Object, | ||
mockBoxConverter.Object, | ||
mockContextStack.Object, | ||
factory.Object | ||
); | ||
|
||
// Act | ||
var result = converter.Convert(targetArc.Object); | ||
|
||
// Assert | ||
result.Should().NotBeNull(); | ||
} | ||
} |
29 changes: 11 additions & 18 deletions
29
DUI3-DX/Converters/Rhino/Speckle.Converters.Rhino7.Tests/EllipseToSpeckleConverterTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,22 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using NUnit.Framework; | ||
using Rhino; | ||
using Speckle.Converters.Common; | ||
using Speckle.Converters.Common.Objects; | ||
using Speckle.Converters.Rhino7.ToSpeckle.Raw; | ||
using Speckle.Testing; | ||
|
||
namespace Speckle.Converters.Rhino7.Tests; | ||
|
||
public class EllipseToSpeckleConverterTests | ||
public class EllipseToSpeckleConverterTests: MoqTest | ||
{ | ||
private MockRepository _repository; | ||
|
||
private Mock<IConversionContextStack<RhinoDoc, UnitSystem>> _conversionContextStack; | ||
|
||
private Mock<ITypedConverter<RG.Plane, SOG.Plane>> _planeConverter; | ||
private Mock<ITypedConverter<RG.Box, SOG.Box>> _boxConverter; | ||
|
||
[SetUp] | ||
public void Setup() | ||
[Test] | ||
public void Convert_Test() | ||
{ | ||
_repository = new(MockBehavior.Strict); | ||
_conversionContextStack = _repository.Create<IConversionContextStack<RhinoDoc, UnitSystem>>(); | ||
_planeConverter = _repository.Create<ITypedConverter<RG.Plane, SOG.Plane>>(); | ||
_boxConverter = _repository.Create<ITypedConverter<RG.Box, SOG.Box>>(); | ||
} | ||
var conversionContextStack = Create<IConversionContextStack<RhinoDoc, UnitSystem>>(); | ||
var planeConverter = Create<ITypedConverter<RG.Plane, SOG.Plane>>(); | ||
var boxConverter = Create<ITypedConverter<RG.Box, SOG.Box>>(); | ||
|
||
[TearDown] | ||
public void Verify() => _repository.VerifyAll(); | ||
var x = new EllipseToSpeckleConverter(planeConverter.Object, boxConverter.Object, conversionContextStack.Object); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.