public void RectangleTest() { Rectangle rectangle = new Rectangle(4, 5); Assert.AreEqual(20, rectangle.Area); Assert.AreEqual(4, rectangle.Length); Assert.AreEqual(5, rectangle.Width); Assert.AreEqual(18, rectangle.Perimeter); Rectangle rectangle2 = new Rectangle(4, 5); Assert.AreEqual(rectangle, rectangle2); }
/// <summary> /// Constructor with a "length", "width", and "height" to base this prism on /// </summary> /// <param name="length"></param> /// <param name="width"></param> /// <param name="height"></param> public RectangularPrism(double length, double width, double height) { _rectangleBase = new Rectangle(length, width); _height = height < 0 ? 0 : height; }
/// <summary> /// /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(Rectangle other) { return other != null && (Math.Abs(_length - other._length) < 1 && Math.Abs(_width - other._width) < 1); }
/// <summary> /// Constructor with a Rectangle, "rectangleBase", and a double, "height", to base this prism on /// </summary> /// <param name="rectangleBase"></param> /// <param name="height"></param> public RectangularPrism(Rectangle rectangleBase, double height) { _rectangleBase = rectangleBase; _height = height < 0 ? 0 : height; }