public function testCanCalculateSurfaceAreaOfTwoDifferentShapes()
 {
     $square = new Square(2);
     $circle = new Circle(4);
     $calculator = new Calculator();
     // expected value
     $value = $square->area() + $circle->area();
     $this->assertEquals($value, $calculator->surfaceArea(compact('square', 'circle')));
 }
예제 #2
0
 public function testItCanCalculateArea()
 {
     $square = new Square(0);
     $this->assertEquals(0, $square->area());
     $square = new Square(2);
     $this->assertEquals(4, $square->area());
     $square = new Square(3.14);
     $this->assertEquals(9.8596, $square->area());
 }