Exemplo n.º 1
0
        public void Square9for3x3Area()
        {
            Square s = new Square()
            {
                Width = 3
            };

            Assert.AreEqual(9, ShapeCalculator.CalculateArea(s));
        }
Exemplo n.º 2
0
        public void Rectangle6for2x3Area()
        {
            Rectangle r = new Rectangle()
            {
                Width = 3, Height = 2
            };

            Assert.AreEqual(6, ShapeCalculator.CalculateArea(r));
        }
Exemplo n.º 3
0
        public void EnsureForShapeAttributeHaveShape(ShapeCalculator calculator)
        {
            var attr = calculator.GetType().GetCustomAttribute <ForShapeAttribute>(false);

            Assert.That(attr.ShapeTarget, Is.Not.Null);
            var isAssignableFromIShape = (typeof(IShape)).IsAssignableFrom(attr.ShapeTarget);

            Assert.That(isAssignableFromIShape, Is.True);
        }
Exemplo n.º 4
0
        public void EnsureCalculatorHaveForShapeAttribute(ShapeCalculator calculator)
        {
            var attr = calculator.GetType().GetCustomAttribute <ForShapeAttribute>(false);

            Assert.That(attr, Is.Not.Null);
        }
Exemplo n.º 5
0
 public ShapeCalculatorTests()
 {
     _testShape           = new Circle(15d);
     _shapeCalculatorMock = new Mock <ShapeCalculator <Circle> >(_testShape);
     _shapeCalculator     = _shapeCalculatorMock.Object;
 }