From 0141538a2d55de3d7554aae7b4e80b280a67ba7b Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 19 Feb 2016 17:48:28 -0800 Subject: [PATCH] Added NotSupportedException on ResizedObject.Position --- .../OSCADSharp.UnitTests.csproj | 1 + .../Transforms/ResizeTests.cs | 22 +++++++++++++++++++ .../OSCADSharp/Transforms/ResizedObject.cs | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 OSCADSharp/OSCADSharp.UnitTests/Transforms/ResizeTests.cs diff --git a/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj b/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj index d9bf4e0..2a6184b 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj +++ b/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj @@ -65,6 +65,7 @@ + diff --git a/OSCADSharp/OSCADSharp.UnitTests/Transforms/ResizeTests.cs b/OSCADSharp/OSCADSharp.UnitTests/Transforms/ResizeTests.cs new file mode 100644 index 0000000..af993df --- /dev/null +++ b/OSCADSharp/OSCADSharp.UnitTests/Transforms/ResizeTests.cs @@ -0,0 +1,22 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using OSCADSharp.Solids; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OSCADSharp.UnitTests.Transforms +{ + [TestClass] + public class ResizeTests + { + [TestMethod] + [ExpectedException(typeof(NotSupportedException))] + public void Resize_PositionNotSupportedAfterResize() + { + var pos = new Cube(5, 5, 20) + .Translate(30, 0, 0).Rotate(0, 90, 0).Resize(2, 2, 2).Position(); + } + } +} diff --git a/OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs b/OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs index 506bdb3..29837c8 100644 --- a/OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs +++ b/OSCADSharp/OSCADSharp/Transforms/ResizedObject.cs @@ -51,7 +51,7 @@ namespace OSCADSharp.Transforms public override Vector3 Position() { - return obj.Position(); + throw new NotSupportedException("Position is not supported on Resized objects."); } } }