public void ElementService_PassCollectionWithDistinctValuesAndAllElementsHaveAgeIsGreaterThan20_ShouldReturn3Elements()
        {
            var collection = new List <Element>()
            {
                CreateNewElement(1, "Raphael", 30),
                CreateNewElement(2, "Rodrigo", 22),
                CreateNewElement(3, "Arthur", 40)
            };

            var newCollection = service.GetElement(collection);

            Assert.Equal(3, newCollection.Count);
        }
Beispiel #2
0
        // GET: Elements/Edit/5
        public ActionResult Edit(int id)
        {
            var viewModel    = service.GetElement(id);
            var bindingModel = new ElementBindingModel
            {
                Id          = id,
                ElementName = viewModel.ElementName
            };

            return(View(bindingModel));
        }
        public ActionResult AddElementPost()
        {
            var output     = (OutputViewModel)Session["Output"];
            var ingredient = new OutputElementViewModel
            {
                ElementId   = int.Parse(Request["ElementId"]),
                ElementName = ingredientService.GetElement(int.Parse(Request["ElementId"])).ElementName,
                Number      = int.Parse(Request["Number"])
            };

            output.OutputElements.Add(ingredient);
            Session["Output"] = output;
            return(RedirectToAction("Index"));
        }
 private void FormElement_Load(object sender, EventArgs e)
 {
     if (id.HasValue)
     {
         try
         {
             ElementViewModel view = service.GetElement(id.Value);
             if (view != null)
             {
                 textBoxComponent.Text = view.ElementName;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
                             MessageBoxIcon.Error);
         }
     }
 }