public void CanDoDeletePostBack()
        {
            //ACT
            var adminUnit = new AdminUnit { AdminUnitID = 1, Name = "Region", ParentID = null, AdminUnitTypeID = 2 };
            dynamic result = _adminUnitController.Delete(1, adminUnit) as JsonResult;

            //ASSERT
            Assert.IsNotNull(result);
            Assert.AreEqual("AdminUnit/Index", result.redirect);
        }
        public void CanDoEditPostback()
        {
            //ACT
            var adminUnit = new AdminUnit {AdminUnitID = 1, Name = "Region", ParentID = null, AdminUnitTypeID = 2};
            var jsonResult = _adminUnitController.Edit(1, adminUnit) as JsonResult;

            //ASSERT
            Assert.IsNotNull(jsonResult);
            dynamic data = jsonResult.Data;
            Assert.AreEqual(true, data.success);
        }
 public void ParentIDTest()
 {
     AdminUnit target = new AdminUnit(); // TODO: Initialize to an appropriate value
     Nullable<int> expected = new Nullable<int>(); // TODO: Initialize to an appropriate value
     Nullable<int> actual;
     target.ParentID = expected;
     actual = target.ParentID;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void NameTest()
 {
     AdminUnit target = new AdminUnit(); // TODO: Initialize to an appropriate value
     string expected = string.Empty; // TODO: Initialize to an appropriate value
     string actual;
     target.Name = expected;
     actual = target.Name;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void FDPsTest()
 {
     AdminUnit target = new AdminUnit(); // TODO: Initialize to an appropriate value
     EntityCollection<FDP> expected = null; // TODO: Initialize to an appropriate value
     EntityCollection<FDP> actual;
     target.FDPs = expected;
     actual = target.FDPs;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void AdminUnitTypeTest()
 {
     AdminUnit target = new AdminUnit(); // TODO: Initialize to an appropriate value
     AdminUnitType expected = null; // TODO: Initialize to an appropriate value
     AdminUnitType actual;
     target.AdminUnitType = expected;
     actual = target.AdminUnitType;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void AdminUnitConstructorTest1()
 {
     AdminUnit target = new AdminUnit();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
 public void AdminUnitConstructorTest()
 {
     AdminUnit target = new AdminUnit();
 }
        public ActionResult Create(AdminUnitModel unit)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var aunit = new AdminUnit {AdminUnitTypeID = unit.SelectedAdminUnitTypeId};
                    if (aunit.AdminUnitTypeID == Shared.Configuration.ZoneTypeId)
                    {
                        aunit.ParentID = unit.SelectedRegionId;
                    }
                    else if (aunit.AdminUnitTypeID == Shared.Configuration.WoredaTypeId)
                    {
                        aunit.ParentID = unit.SelectedZoneId;
                    }
                    aunit.Name = unit.UnitName;
                    aunit.NameAM = unit.UnitNameAM;

                    _adminUnitService.AddAdminUnit(aunit);
                    return Json(new {success = true});
                }
                catch (Exception)
                {
                    return View();
                }
            }
            return View("Create");
        }
 public ActionResult Edit(int id, AdminUnit unit)
 {
     if (ModelState.IsValid)
     {
         _adminUnitService.EditAdminUnit(unit);
         return Json(new {success = true});
     }
     return PartialView("Edit", unit);
 }
 public ActionResult Delete(int id, AdminUnit unit)
 {
     try
     {
         _adminUnitService.DeleteAdminUnit(unit);
         return RedirectToAction("Index");
     }
     catch
     {
         return View("Delete");
     }
 }