public void Initialize() { CargoDAO cargoDao = new CargoDAO(); cargo1 = CreateCargo(); cargo2 = CreateCargo(); cargo2.Type = "newtype"; cargoDao.InsertCargo(cargo1); cargoDao.InsertCargo(cargo2); BaseDAO bas = new BaseDAO(); newBase = new Base(); newBase.Planet = "Země"; bas.InsertBase(newBase); PlayerDAO playerDao = new PlayerDAO(); player = CreatePlayer(); playerDao.InsertPlayer(player); SpaceShipDAO shipDao = new SpaceShipDAO(); ship = CreateSpaceShip(); shipDao.InsertSpaceShip(ship); }
public void GetCargosTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); target.InsertCargo(cargo); oldId = cargo.CargoId; cargo.Type = "newType"; target.InsertCargo(cargo); List <Cargo> cargos = target.GetCargos(); Assert.IsNotNull(cargos); }
public void GetCargosByTypeTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); target.InsertCargo(cargo); oldId = cargo.CargoId; string type = RandomString(6); cargo.Type = type; target.InsertCargo(cargo); List <Cargo> cargos = target.GetCargosByType(type); Assert.IsTrue(cargos.Count == 1); }
public void InsertCargoTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); bool insert = target.InsertCargo(cargo); Assert.IsTrue(insert); }
public void TestInitialize() { cargo = new Cargo(); cargo.Price = 200; cargo.Type = "nářadí"; CargoDAO dao = new CargoDAO(); dao.InsertCargo(cargo); }
public void RemoveCargoByIdTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); target.InsertCargo(cargo); bool remove = target.RemoveCargoById(cargo.CargoId); Assert.IsTrue(remove); cargo = null; }
public void GetCargoByIdTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); target.InsertCargo(cargo); Cargo newCargo = target.GetCargoById(cargo.CargoId); Assert.IsTrue(newCargo.CargoId == cargo.CargoId && newCargo.Type == cargo.Type && cargo.Price == cargo.Price); }
public JsonResult JsInsert(Cargo cargo) { var cargoDAO = new CargoDAO(); cargoDAO.InsertCargo(cargo); var result = new { type = "success", field = "", message = "Registro adicionado com sucesso!", model = cargo }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public void UpdateCargoByIdTest() { CargoDAO target = new CargoDAO(); cargo = CreateCargo(); target.InsertCargo(cargo); cargo.Price = 500; string type = RandomString(6); cargo.Type = type; target.UpdateCargoById(cargo); Cargo newCargo = target.GetCargoById(cargo.CargoId); Assert.IsTrue(newCargo.CargoId == cargo.CargoId && newCargo.Type == type && cargo.Price == 500); }
public ActionResult Create(Cargo cargo) { try { if (ModelState.IsValid) { var cargoDAO = new CargoDAO(); cargoDAO.InsertCargo(cargo); return(RedirectToAction("Index")); } return(View()); } catch { return(View()); } }