Beispiel #1
0
        public void CalculateArea_SomeValues_MatchResult(double radius, double expected)
        {
            var circle = _factory.CreateCircle(radius);

            var area = _calc.GetArea(circle);

            area.Should().BeApproximately(expected, 1e-10);
        }
        public void Should_ReturnSameAreaWithGivenPrecision_When_CircleGetAreaInvoked(double precision)
        {
            var radius   = _fixture.Create <double>();
            var circle   = _figureFactoryfactory.CreateCircle(radius);
            var expected = radius * radius * Math.PI;
            var result   = circle.GetArea();
            var diff     = expected - result;

            diff = diff * Math.Sign(diff);

            Assert.IsTrue(diff <= precision);
        }
Beispiel #3
0
 public Figure(FigureFactory factory)
 {
     circle = factory.CreateCircle();
     square = factory.CreateSquare();
 }
Beispiel #4
0
        public void Should_CreateCircleInstance_When_CircleFactoryCreateCircle()
        {
            var result = _figureFactoryfactory.CreateCircle(It.IsAny <double>());

            Assert.IsInstanceOfType(result, typeof(Circle));
        }