Ejemplo n.º 1
0
        // WEBAPI2 HAS METHOD SIGNATURE ROUTING
        public CalculatorResult Get()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.Triangle2DEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate();
            return(new CalculatorResult(rc.PI, rc.CalculationTime));
        }
Ejemplo n.º 2
0
        public void TestMethod_EgyptianPyramid()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.EgyptianPyramidEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate();
            Assert.AreEqual(rc.PI, 3.14, 0.05, "INVALID EGYPT CALCULATION");
        }
Ejemplo n.º 3
0
        public void TestMethod_ArcTangent()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.ArcTangentEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate();
            Assert.AreEqual(rc.PI, 3.14, 0.05, "INVALID ARCTANGENT CALCULATION");
        }
Ejemplo n.º 4
0
        public void TestMethod_Nilakantha()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.NilakanthaEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate(10000);
            Assert.AreEqual(rc.PI, 3.14, 0.05, "INVALID NILAKANTHA CALCULATION");
        }
Ejemplo n.º 5
0
        public void TestMethod_MonteCarlo3D_100()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.MonteCarlo3DEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate(100);
            Assert.AreEqual(rc.PI, 3.141, 0.005, "INVALID MONTECARLO 3D CALCULATION");
        }
Ejemplo n.º 6
0
        public void TestMethod_GregoryLeibniz_HundredMillionCalc()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.GregoryLeibnizEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate(1000000 * 10);
            Assert.AreEqual(rc.PI, 3.14, 0.005, "INVALID GREGORY-LEIBNIZ CALCULATION");
        }
Ejemplo n.º 7
0
        public CalculatorResult Calculate()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine();
            CalculatorResult rc = null;

            rc = engine.Calculate();
            return(new CalculatorResult(rc.PI, rc.CalculationTime));
        }
Ejemplo n.º 8
0
        public void TestMethod_Pyramid2DEngine()
        {
            ConstantModel   model  = new ConstantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine(PI_ENGINE_TYPE.Triangle2DEngine);
            //engine = model.GetconstantEngine(PI_ENGINE_TYPE.GregoryLeibnizEngine);
            CalculatorResult rc = null;

            rc = engine.Calculate(1000);
            Assert.AreEqual(rc.PI, 3.14, 0.10, "INVALID PYRAMID2D CALCULATION");
        }
Ejemplo n.º 9
0
    protected void btnCalculate_Click(object sender, EventArgs e)
    {
        constantModel   model  = new constantModel();
        IconstantEngine engine = null;

        engine = model.GetconstantEngine();
        CalculatorResultModel rc = null;

        rc             = engine.Calculate();
        txtResult.Text = "Value for PI " + rc.PI + "\n" +
                         "Calculation Time " + rc.CalculationTime.ToString() + " millisecond(s)" + "\n" +
                         "Moon Volume " + rc.MoonVolume.ToString();
    }
Ejemplo n.º 10
0
        // GET: Calculator
        public ActionResult Index(string btnCalculate)

        {
            if (btnCalculate == "Calculate")
            {
                ConstantModel   model  = new ConstantModel();
                IconstantEngine engine = null;
                engine = model.GetconstantEngine();
                CalculatorResult rc = null;
                rc = engine.Calculate();
                return(View(new CalculatorResult(rc.PI, rc.CalculationTime)));
            }
            else
            {
                return(View(new CalculatorResult()));
            }
        }
Ejemplo n.º 11
0
        public CalculatorResultModel Calculate()
        {
            // FIELD VALIDATIONS
            // OR USE GENERIC HTTP ERROR VALUE FUNCTION
            // NLOG TRANSACTIONS AND ERRORS
            // VALIDATION SHOULD OCCUR AT EACH LEVEL OF COMMUNICATION
            // HTML VALIDATION BEFORE SEND
            // WEBAPI2 VALIDATION


            constantModel   model  = new constantModel();
            IconstantEngine engine = null;

            engine = model.GetconstantEngine();
            CalculatorResultModel rc = null;

            rc = engine.Calculate();
            return(new CalculatorResultModel(rc.PI, rc.CalculationTime));
        }