Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public void Testdiv(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Div(m, n), 2);
 }
Exemplo n.º 6
0
 public void Testmul(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Mul(m, n), 20);
 }
Exemplo n.º 7
0
 public void Testsub(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Sub(m, n), 1);
 }
Exemplo n.º 8
0
 //[DataRow(5, 4)]
 public void Testadd(int m, int n)
 {
     Assert.AreEqual(CalculatorMain.Add(m, n), 9);
 }
Exemplo n.º 9
0
 public void Setup() => getCalcDivide = new CalculatorMain();