public void PentagonDefaultConstructor() { sut = new Pentagon(); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(_defaultSize * 5)); Assert.That(sut.CalculateArea(), Is.EqualTo(GetExpectedAreaForPentagon(_defaultSize))); }
public void SquareDefaultConstructor() { sut = new Square(); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(_defaultSize * 4)); Assert.That(sut.CalculateArea(), Is.EqualTo(Math.Pow(_defaultSize, 2))); }
public void SquareParameterizedConstructor() { var len = 10; sut = new Square(len); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(len * 4)); Assert.That(sut.CalculateArea(), Is.EqualTo(Math.Pow(len, 2))); }
public void PentagonParameterizedConstructor() { var len = 10; sut = new Pentagon(len); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(len * 5)); Assert.That(sut.CalculateArea(), Is.EqualTo(GetExpectedAreaForPentagon(len))); }
public void CircleParameterizedConstructor() { var radius = 10; sut = new Circle(radius); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(2 * Math.PI * radius)); Assert.That(sut.CalculateArea(), Is.EqualTo(Math.PI * Math.Pow(radius, 2))); }
public void RectangleParameterizedConstructor() { var width = 10; var height = 20; sut = new Rectangle(width, height); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(2 * width + 2 * height)); Assert.That(sut.CalculateArea(), Is.EqualTo(width * height)); }
public void SquareCopyConstructor() { var len = 15; var squareToCopy = new Square(len); sut = new Square(squareToCopy); Assert.That(sut.CalculateArea(), Is.EqualTo(squareToCopy.CalculateArea())); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(squareToCopy.CalculatePerimeter())); }
public void PentagonCopyConstructor() { var len = 15; var PentagonToCopy = new Pentagon(len); sut = new Pentagon(PentagonToCopy); Assert.That(sut.CalculateArea(), Is.EqualTo(PentagonToCopy.CalculateArea())); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(PentagonToCopy.CalculatePerimeter())); }
public void CircleCopyConstructor() { var radius = 5; var circleToCopy = new Circle(radius); sut = new Circle(circleToCopy); Assert.That(sut.CalculateArea(), Is.EqualTo(circleToCopy.CalculateArea())); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(circleToCopy.CalculatePerimeter())); }
public void RectangleCopyConstructor() { var width = 5; var height = 15; var rectangleToCopy = new Rectangle(width, height); sut = new Rectangle(rectangleToCopy); Assert.That(sut.CalculateArea(), Is.EqualTo(rectangleToCopy.CalculateArea())); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(rectangleToCopy.CalculatePerimeter())); }
public void EllipseCopyConstructor() { var semiMajorAxis = 5; var semiMinorAxis = 15; var EllipseToCopy = new Ellipse(semiMajorAxis, semiMinorAxis); sut = new Ellipse(EllipseToCopy); Assert.That(sut.CalculateArea(), Is.EqualTo(EllipseToCopy.CalculateArea())); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(EllipseToCopy.CalculatePerimeter())); }
public void EllipseParameterizedConstructor() { var semiMajorAxis = 10; var semiMinorAxis = 20; sut = new Ellipse(semiMajorAxis, semiMinorAxis); Assert.That(sut.CalculatePerimeter(), Is.EqualTo(2 * Math.PI * Math.Sqrt( (Math.Pow(semiMajorAxis, 2) + Math.Pow(semiMinorAxis, 2)) / 2))); Assert.That(sut.CalculateArea(), Is.EqualTo(Math.PI * semiMajorAxis * semiMinorAxis)); }
public virtual double CalculateShapeArea() { return(shape.CalculateArea()); }