コード例 #1
0
        public void ShouldCalculateCorectAreaFor(int lenght, int width, int expectedArea)
        {
            var shape = new OldAndStupidRectangle(lenght, width);

            var actualArea = ShapeAreaManager.CalculateArea(shape);

            Assert.AreEqual(expectedArea, actualArea);
        }
コード例 #2
0
        public void ShouldHaveInvalidPostconditionsFor(int lenght, int width)
        {
            Assert.Throws <InvalidOperationException>(() =>
            {
                var shape = new OldAndStupidRectangle(lenght, width);

                ShapeAreaManager.CalculateArea(shape);
            }, "Something is wrong!");
        }
コード例 #3
0
        public void ShouldHaveInvalidPreconditionsFor(int lenght, int width)
        {
            Assert.Throws <Exception>(() =>
            {
                var shape = new OldAndStupidRectangle(lenght, width);

                ShapeAreaManager.CalculateArea(shape);
            });
        }
コード例 #4
0
 public static double CalculateArea(OldAndStupidRectangle shape)
 {
     return(shape.Area());
 }