public void UpdateBikeTest() { UpdateBikeInfo update = new UpdateBikeInfo { Manufacturer = "ABC" }; Tandem bike = tandemService.UpdateBike(1, update); Assert.IsTrue(bike.Manufacturer == "ABC"); }
/// <summary>Get bike by QR code</summary> /// <param name="QRCode">QR Code you want to find</param> /// <returns>Return the bike with specified QR Code or null if not found</returns> public BaseBike GetBikeByQRCode(string QRCode) { BaseBike baseBike = connecter.SqlData.BaseBikes.SingleOrDefault(x => x.QRCode == QRCode); BaseBike result = null; if (baseBike.Category == "bike") { result = new Bike(baseBike); } else if (baseBike.Category == "tandem") { result = new Tandem(baseBike); } else if (baseBike.Category == "electric") { ElectricBikeTable electricBike = connecter.SqlData.ElectricBikes.Find(baseBike.BikeId); result = new ElectricBike(baseBike, electricBike); } return(result); }
/// <summary> /// Get bike by bike's id /// </summary> /// <param name="id">the bike's id you want to find</param> /// <returns>Return the bike with specified ID or null if not found</returns> public BaseBike GetBikeById(int id) { BaseBike baseBike = connecter.SqlData.BaseBikes.Find(id); BaseBike result = null; if (baseBike.Category == "bike") { result = new Bike(baseBike); } else if (baseBike.Category == "tandem") { result = new Tandem(baseBike); } else if (baseBike.Category == "electric") { ElectricBikeTable electricBike = connecter.SqlData.ElectricBikes.Find(baseBike.BikeId); result = new ElectricBike(baseBike, electricBike); } return(result); }
public void GetBikeByIdTest() { Tandem tandem = tandemService.GetBikeById(1); Assert.IsNotNull(tandem); }
public void GetBikeByNotExistQRCodeTest() { Tandem tandem = tandemService.GetBikeByQRCode("100000000"); Assert.IsNull(tandem); }