示例#1
0
        public void Add()
        {
            var rnd = new Random();
            var i1  = rnd.NextDouble();
            var i2  = rnd.NextDouble();

            var res = API.Add(i1, i2);

            if (!string.IsNullOrWhiteSpace(res.Error))
            {
                Assert.Fail("The API call failed with the following internal error: " + res.Error);
            }

            Assert.AreEqual(i1 + i2, res.Result, 0.0000000001);
        }
示例#2
0
        public ActionResult Index([Bind(Include = "GingerbreadVM, OrderVM, CurrentCurrency")] IndexVM index, string dealOperation)
        {
            if (ModelState.IsValid)
            {
                index.OrderVM.DealOperation = dealOperation == Deal.Buy.ToString() ? Deal.Buy : Deal.Sell;
                var gingerbread = new Gingerbread(count: index.GingerbreadVM.Count, price: index.GingerbreadVM.Price /*index.CurrentCurrency.AttitudeToRuble*/);
                var order       = new Order(email: index.OrderVM.Email, dealOperation: index.OrderVM.DealOperation, gingerbread: gingerbread);
                //OrderService.AddOrder(order);
                api.Add(order);

                ExecuteOrder(order);
            }
            var compIndex = GetCompositeViewModel();

            return(View(compIndex));
        }