public async Task GetTruck_Exists_ReturnsOK()
        {
            // create model
            var model = new Model();

            model.Description = Guid.NewGuid().ToString();

            IActionResult actionResult = await _modelController.PostModel(model);

            var modelCreatedResult = actionResult as CreatedAtActionResult;

            Assert.IsNotNull(modelCreatedResult);
            Assert.AreEqual(201, modelCreatedResult.StatusCode);
            model.ModelId = Convert.ToInt32(modelCreatedResult.RouteValues["id"]);

            // create truck
            var truck = new Truck();

            truck.Chassis = Guid.NewGuid().ToString();
            truck.Year    = Convert.ToInt16(new Random().Next(1900, 2019));
            truck.Model   = model;

            actionResult = await _truckController.PostTruck(truck);

            var createdResult = actionResult as CreatedAtActionResult;

            Assert.IsNotNull(createdResult);
            Assert.AreEqual(201, createdResult.StatusCode);

            // get first
            var list = _truckController.GetTrucks();

            truck = list.FirstOrDefault <Truck>();

            // get by id
            actionResult = await _truckController.GetTruck(truck.TruckId);

            var okResult = actionResult as OkObjectResult;

            Assert.IsNotNull(okResult);
            Assert.AreEqual(200, okResult.StatusCode);

            Assert.Pass();
        }
 private void LoadData()
 {
     try
     {
         if (this.truckId > 0)
         {
             Truck truck = TruckController.GetTruck(this.truckId);
             txtTruckId.Text               = this.truckId.ToString();;
             txtTruckNo.Text               = truck.TruckNo.ToString();
             txtDriver.Text                = truck.Driver.ToString();
             chkActive.Checked             = truck.Active;
             comboxTruckType.SelectedValue = truck.TruckType.TruckTypeId;
             BtnSaveAndNew.Visible         = false;
             txtTruckNo.Enabled            = false;
         }
     }
     catch (Exception)
     {
     }
 }