コード例 #1
0
ファイル: CarManager.cs プロジェクト: CH033dotNET/Taxi
 /// <summary>
 /// Edits car object using values from second input object and maps edited object to another type
 /// </summary>
 /// <param name="newCarObj">object that must be edited</param>
 /// <param name="inputCarObj">object which values are used for editing</param>
 /// <returns></returns>
 private CarDTO SetCarStateModified(Car newCarObj, CarDTO inputCarObj)
 {
     uOW.CarRepo.SetStateModified(newCarObj);
     newCarObj.CarName = inputCarObj.CarName;
     newCarObj.CarNumber = inputCarObj.CarNumber;
     newCarObj.CarOccupation = inputCarObj.CarOccupation;
     newCarObj.CarClass = inputCarObj.CarClass;
     newCarObj.CarPetrolType = inputCarObj.CarPetrolType;
     newCarObj.CarPetrolConsumption = inputCarObj.CarPetrolConsumption;
     newCarObj.CarManufactureDate = inputCarObj.CarManufactureDate;
     newCarObj.CarState = inputCarObj.CarState;
     newCarObj.CarNickName = inputCarObj.CarNickName;
     uOW.Save();
     return Mapper.Map<CarDTO>(newCarObj);
 }
コード例 #2
0
ファイル: CarTestClass.cs プロジェクト: CH033dotNET/Taxi
 public void TestCarById()
 {
     int id = 2;
     int carId = 0;
     string status = "";
     var newlist = new Car();
     if (id <= 0 || carId <= 0) { status = "nocar"; }
     else
     {
         newlist = testCars.Where(s => s.Id == carId).FirstOrDefault();
         if (newlist == null) { status = "null"; }
         else status = "one";
     }
     //Assert.IsNotNull(newlist);
     Assert.AreSame(status, "nocar");
 }
コード例 #3
0
ファイル: CarManager.cs プロジェクト: CH033dotNET/Taxi
 /// <summary>
 /// Private manager method taht is used to change isMain property of a specific car object`s property.
 /// </summary>
 /// <param name="carToChange">Input parameter that represents object that we need to change.</param>
 /// <returns></returns>
 private string MakeACarMain(Car carToChange)
 {
     try
     {
         uOW.CarRepo.SetStateModified(carToChange);
         carToChange.isMain = !carToChange.isMain;
         uOW.Save();
     }
     catch (Exception)
     {
         return "Error";
     }
     return "Success";
 }