Example #1
0
        public string Get(double radiusD,
                          double widthF,
                          double heightF,
                          double lengthF)
        {
            string result = $"calculate me {radiusD} {widthF} {heightF} {lengthF}";

            if (DoubleValueVerifier.IsDoubleArrayValid(
                    new double[] { radiusD, widthF, heightF, lengthF }))
            {
                CircleModel door   = new CircleModel(radiusD);
                CubeModel   fridge = new CubeModel(widthF, heightF, lengthF);

                result =
                    CalculatorMain.CubeToCircle(door, fridge)
                        ?
                    $"true, door: {door.ToString()}; fridge: {fridge.ToString()}"
                        :
                    $"false, door: {door.ToString()};fridge: {fridge.ToString()}";
            }
            else
            {
                result += "; Some bad value(s)!";
            }

            return(result);
        }
        public string Get(double radiusD,
                          double radiusF)
        {
            string result = $"calculate me {radiusD} {radiusF}";

            if (DoubleValueVerifier.IsDoubleArrayValid(
                    new double[] { radiusD, radiusF }))
            {
                result =
                    CalculatorMain.BallToCircle(new CircleModel(radiusD),
                                                new BallModel(radiusF))
                    ?
                    "true" : "false";
            }
            else
            {
                result += "\nSome bad value(s)!";
            }

            return(result);
        }
        public string Get(double widthD,
                          double heightD,
                          double radiusF)
        {
            string result = $"calculate me {widthD} {heightD} {radiusF}";

            if (DoubleValueVerifier.IsDoubleArrayValid(
                    new double[] { widthD, heightD, radiusF }))
            {
                result =
                    CalculatorMain.BallToSquare(new SquareModel(widthD, heightD),
                                                new BallModel(radiusF))
                    ?
                    "true" : "false";
            }
            else
            {
                result += "\nSome bad value(s)!";
            }

            return(result);
        }
        public string Get(double widthD,
                          double heightD,
                          double widthF,
                          double heightF,
                          double lengthF)
        {
            string result = $"calculating {widthD} {heightD} {widthF} {heightF} {lengthF}";

            if (DoubleValueVerifier.IsDoubleArrayValid(
                    new double[] { widthD, heightD, widthF, heightF, lengthF }))
            {
                result =
                    CalculatorMain.CubeToSquare(new SquareModel(widthD, heightD),
                                                new CubeModel(widthF, heightF, lengthF))
                                        ?
                    "true" : "false";
            }
            else
            {
                result += "\nSome bad value(s)!";
            }

            return(result);
        }
Example #5
0
 public void Testdiv(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Div(m, n), 2);
 }
Example #6
0
 public void Testmul(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Mul(m, n), 20);
 }
Example #7
0
 public void Testsub(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Sub(m, n), 1);
 }
Example #8
0
 //[DataRow(5, 4)]
 public void Testadd(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Add(m, n), 9);
 }
Example #9
0
 public void Setup() => getCalcDivide = new CalculatorMain();