Created
March 28, 2017 14:31
-
-
Save fffej/10ca04b04a94805c3700ea67413356f3 to your computer and use it in GitHub Desktop.
Kata number 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TDDKata2 | |
{ | |
public class Class1 | |
{ | |
[Test] | |
public void Volume_Of_A_Cube() | |
{ | |
Assert.That(new Cube(1).Volume, Is.EqualTo(1)); | |
} | |
[Test] | |
public void Volume_of_a_Cylinder() | |
{ | |
Assert.That(Cylinder.GetVolume(1, 1), Is.EqualTo(Math.PI)); | |
Assert.That(Cylinder.GetVolume(2, 1), Is.EqualTo(2 * Math.PI)); | |
} | |
[Test] | |
public void Volume_of_a_Pyramid() | |
{ | |
Assert.That(Volume.Of(new Pyramid(1, 1)), Is.EqualTo(1.0/3)); | |
} | |
} | |
public static class Cylinder | |
{ | |
public static double GetVolume(int height, int radius) | |
{ | |
return Math.PI * radius * radius * height; | |
} | |
} | |
public class Cube | |
{ | |
private readonly int _width; | |
public Cube(int width) | |
{ | |
_width = width; | |
} | |
public double Volume => _width * _width * _width; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment