From 1402690f2d0a909baf4be09d30e2809551e3a2d3 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sun, 14 Feb 2016 18:36:55 -0800 Subject: [PATCH] Fix for missing Diameter value assignment in Cylinder constructor --- .../OSCADSharp.UnitTests/CylinderTests.cs | 27 +++++++++++++++++++ .../OSCADSharp.UnitTests.csproj | 1 + OSCADSharp/OSCADSharp/Solids/Cylinder.cs | 1 + 3 files changed, 29 insertions(+) create mode 100644 OSCADSharp/OSCADSharp.UnitTests/CylinderTests.cs diff --git a/OSCADSharp/OSCADSharp.UnitTests/CylinderTests.cs b/OSCADSharp/OSCADSharp.UnitTests/CylinderTests.cs new file mode 100644 index 0000000..ff3f83b --- /dev/null +++ b/OSCADSharp/OSCADSharp.UnitTests/CylinderTests.cs @@ -0,0 +1,27 @@ +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 +{ + [TestClass] + public class CylinderTests + { + [TestMethod] + public void Cylinder_ConstructorParametersAffectScriptOutput() + { + var cylinder = new Cylinder(5.5, 12.1, true); + + string script = cylinder.ToString(); + + Assert.IsTrue(script.Contains("r1 = 2.75")); + Assert.IsTrue(script.Contains("r2 = 2.75")); + Assert.IsTrue(script.Contains("h = 12.1")); + Assert.IsTrue(script.Contains("center = true")); + } + } +} diff --git a/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj b/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj index 566ba5d..8f35a50 100644 --- a/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj +++ b/OSCADSharp/OSCADSharp.UnitTests/OSCADSharp.UnitTests.csproj @@ -53,6 +53,7 @@ + diff --git a/OSCADSharp/OSCADSharp/Solids/Cylinder.cs b/OSCADSharp/OSCADSharp/Solids/Cylinder.cs index ff752f3..22f6bbc 100644 --- a/OSCADSharp/OSCADSharp/Solids/Cylinder.cs +++ b/OSCADSharp/OSCADSharp/Solids/Cylinder.cs @@ -111,6 +111,7 @@ namespace OSCADSharp.Solids public Cylinder(double diameter = 2, double height = 1, bool center = false) { this.Diameter = diameter; + this.Height = height; this.Center = center; } #endregion