mirror of
https://github.com/eliasstepanik/OSCADSharpDotnet7.git
synced 2026-01-11 21:48:34 +00:00
+ Added a Clone() test for Sphere
This commit is contained in:
parent
dc950b5fdb
commit
7efd7f161d
@ -53,5 +53,21 @@ namespace OSCADSharp.UnitTests
|
||||
Assert.IsTrue(script.StartsWith("sphere("));
|
||||
Assert.IsTrue(script.EndsWith(");"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Sphere_CloneCoversEveryAttribute_copyWithAllAttributes()
|
||||
{
|
||||
var sphere = new Sphere()
|
||||
{
|
||||
Diameter = 10,
|
||||
MinimumAngle = 5,
|
||||
MinimumFragmentSize = 5,
|
||||
Resolution = 30
|
||||
};
|
||||
|
||||
var clone = sphere.Clone();
|
||||
|
||||
Assert.IsTrue(sphere.Equals(clone));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,23 @@ namespace OSCADSharp.Solids
|
||||
Radius = this.Radius
|
||||
};
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
{
|
||||
if(other.GetType() == typeof(Sphere))
|
||||
{
|
||||
Sphere otherSphere = other as Sphere;
|
||||
return this.Diameter == otherSphere.Diameter &&
|
||||
this.Radius == otherSphere.Radius &&
|
||||
this.MinimumAngle == otherSphere.MinimumAngle &&
|
||||
this.MinimumFragmentSize == otherSphere.MinimumFragmentSize &&
|
||||
this.Resolution == otherSphere.Resolution;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.Equals(other);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user