Fix for missing Diameter value assignment in Cylinder constructor

This commit is contained in:
Mike Smith 2016-02-14 18:36:55 -08:00
parent 750937a25e
commit 1402690f2d
3 changed files with 29 additions and 0 deletions

View File

@ -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"));
}
}
}

View File

@ -53,6 +53,7 @@
</Choose>
<ItemGroup>
<Compile Include="CubeTests.cs" />
<Compile Include="CylinderTests.cs" />
<Compile Include="OSCADObjectTests.cs" />
<Compile Include="SphereTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -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