public void UpdateFailNoId() { var Old = new car() { odometer = 1000, year = 2000, price = 5000 }; _carList.Add(Old); _cars.Plot(Old, out uniqueOut); try { Old.price = 4500; Old.UniqueId = 0; _cars.Update(In: Old); Assert.Fail(); } catch (UniqueIdException) { // Expected. } catch { Assert.Fail(); } }
public void RemoveFound() { _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _carList.Add(new car() { odometer = 2000, year = 2000, price = 4000 }); _carList.Add(new car() { odometer = 3000, year = 2000, price = 3000 }); _carList.Add(new car() { odometer = 2000, year = 2000, price = -4000 }); _carList.Add(new car() { odometer = 2000, year = 2000, price = 4000 }); _cars.Plot(_carList); var _car = new car() { odometer = 2000, year = 2000, price = 4000 }; Assert.IsTrue(_cars.RemoveAll(_car)); }
public void fullAndIndexScanAreNotEqual() { _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _cars.Plot(_carList); var _car = new car() { odometer = 1000, year = 2000, price = 5004 }; var _car2 = new car() { odometer = 1000, year = 2000, price = 10000 }; Assert.AreNotEqual(_cars.Nearest <car>(_car2).Count, _cars.NearestFullScan(_car).Count); }
public void fullAndIndexScanAreEqual() { _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _carList.Add(new car() { odometer = 1000, year = 2000, price = 5000 }); _cars.Plot(_carList); var _car = new car() { odometer = 1000, year = 1999, price = 5010 }; var n1 = _cars.Nearest <car>(_car).Count; var n2 = _cars.NearestFullScan(_car).Count; Assert.AreEqual(n1, n2); }
public void UpdateSuccess() { var Old = new car() { UniqueId = 10, odometer = 1000, year = 2000, price = 5000 }; _cars.Plot(Old, out uniqueOut); car New = _cars.Get(uniqueOut) as car; New.price = 4500; Assert.IsTrue(_cars.Update(In: New)); Assert.AreEqual(uniqueOut, _cars.Get(uniqueOut).UniqueId); }
public void plotInvalidAtleast2Dimension() { car _car = new car(); _car.Coordinate = new double?[1]; try { _carList.Add(_car); _cars.Plot(_carList); Assert.Fail(); } catch (DimensionException) { // Expected result. } catch { Assert.Fail(); } }