public void Test6(string name) { FoodController foodController = new FoodController(null, null, context.Object); JsonResult json = (JsonResult)foodController.GetFood(name); List <FoodModel> Foods = (List <FoodModel>)json.Value; Assert.Equal("パン", Foods[0].Name); }
public void GetByFoodIdPositive() { var repo = new Mock <FoodRep>(db); FoodController controller = new FoodController(repo.Object); var data = controller.GetFood(1); var result = data as ObjectResult; Assert.AreEqual(200, result.StatusCode); }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "food") { FoodController collController = coll.gameObject.GetComponent <FoodController>(); food += collController.GetFood() * foodMultiplier; collController.DestroyModel(); } }
private void SearchClicked(object sender, EventArgs e) { string id = tbId.Text; dynamic food = FoodController.GetFood(id); if (food != null) { panel.Visible = true; tbName.Text = food.Name; tbQuantity.Text = Convert.ToString(food.Quantity); tbPrice.Text = Convert.ToString(food.Price); dynamic restaurant = RestaurantController.GetRestaurant(food.RestId); tbRestaurant.Text = restaurant.Name; } else { MessageBox.Show("No Food Found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ConfrimCliked(object sender, EventArgs e) { var discount = new { DiscountID = 0, FoodId = tbFoodId.Text, Amount = Convert.ToInt32(tbAmount.Text), DName = tbName.Text }; var foodResult = FoodController.GetFood(tbFoodId.Text); if (foodResult != null) { int a = foodResult.Price - Convert.ToInt32(tbAmount.Text); if (a >= 0) { var price = new { Price = a, Id = tbFoodId.Text }; var discountResult = DiscountController.AddDiscount(discount); if (discountResult) { var priceDeduct = FoodController.UpdateFood2(price); MessageBox.Show("Discount Added Successfully", "Discount add", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Insuffficient Discount", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Food Not Found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void confrim_Click(object sender, EventArgs e) { string FoodId = tbId.Text; var DiscountResult = DiscountController.DeleteDiscount(FoodId); if (DiscountResult) { MessageBox.Show("Remove Discount Successfully"); var foodResult = FoodController.GetFood(FoodId); var DiscountResult1 = DiscountController.GetDiscount(FoodId); int a = foodResult.Price + DiscountResult1.Amount; var updatePrice = new { Id = FoodId, Price = a }; var updateResult = FoodController.UpdateFood2(updatePrice); } else { MessageBox.Show("Food Not Found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ConfirmClicked(object sender, EventArgs e) { var order = new { OrderId = 0, FId = tbId.Text, FQuantity = Convert.ToInt32(tbQuantity.Text) }; var FoodResult = FoodController.GetFood(tbId.Text); if (FoodResult != null) { int a = FoodResult.Quantity - Convert.ToInt32(tbQuantity.Text); if (a > 0) { var food = new { Id = tbId.Text, Quantity = a }; var x = FoodController.UpdateFood1(food); var OrderResult = OrderController.AddOrder(order); if (OrderResult) { MessageBox.Show("Confirm Order Successfully", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Sorry Food is not available right now", "Quantity", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Could not find any food", "Order", MessageBoxButtons.OK, MessageBoxIcon.Error); } }