Exemple #1
0
 /// <summary>Initializes a new instance of the <see cref="Car"/> class.</summary>
 /// <param name="primaryKey">The primary key.</param>
 /// <param name="name">The name.</param>
 /// <param name="manufacturerKey">The manufacturer key.</param>
 /// <param name="year">The year.</param>
 /// <param name="category">The category.</param>
 /// <param name="price">The price.</param>
 /// <param name="displacementCC">The displacement cc.</param>
 /// <param name="maxPower">The maximum power.</param>
 /// <param name="powerRPM">The power RPM.</param>
 /// <param name="torqueFTLB">The torque FTLB.</param>
 /// <param name="torqueRPM">The torque RPM.</param>
 /// <param name="driveTrain">The drive train.</param>
 /// <param name="aspiration">The aspiration.</param>
 /// <param name="length">The length.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="weight">The weight.</param>
 /// <param name="maxSpeed">The maximum speed.</param>
 /// <param name="acceleration">The acceleration.</param>
 /// <param name="braking">The braking.</param>
 /// <param name="cornering">The cornering.</param>
 /// <param name="stability">The stability.</param>
 /// <exception cref="ArgumentNullException">
 /// primaryKey or name or manufacturerKey or category or displacementCC or powerRPM or
 /// torqueRPM or driveTrain or aspiration
 /// </exception>
 public Car(string primaryKey, string name, string manufacturerKey, int year, CarCategory.Category category, double price,
            string displacementCC, int maxPower, string powerRPM, double torqueFTLB, string torqueRPM, string driveTrain,
            string aspiration, double length, double width, double height, double weight, double maxSpeed, double acceleration,
            double braking, double cornering, double stability)
 {
     PrimaryKey      = primaryKey ?? throw new ArgumentNullException(nameof(primaryKey));
     Name            = name ?? throw new ArgumentNullException(nameof(name));
     ManufacturerKey = manufacturerKey ?? throw new ArgumentNullException(nameof(manufacturerKey));
     this.Year       = year;
     Category        = category ?? throw new ArgumentNullException(nameof(category));
     this.Price      = price;
     DisplacementCC  = displacementCC ?? throw new ArgumentNullException(nameof(displacementCC));
     MaxPower        = maxPower;
     PowerRPM        = powerRPM ?? throw new ArgumentNullException(nameof(powerRPM));
     TorqueFTLB      = torqueFTLB;
     TorqueRPM       = torqueRPM ?? throw new ArgumentNullException(nameof(torqueRPM));
     DriveTrain      = driveTrain ?? throw new ArgumentNullException(nameof(driveTrain));
     Aspiration      = aspiration ?? throw new ArgumentNullException(nameof(aspiration));
     this.Length     = length;
     this.Width      = width;
     this.Height     = height;
     this.Weight     = weight;
     MaxSpeed        = maxSpeed;
     Acceleration    = acceleration;
     Braking         = braking;
     Cornering       = cornering;
     Stability       = stability;
 }
 /// <summary>Validates the category.</summary>
 /// <param name="category">The category.</param>
 /// <exception cref="GTSport_DT.Cars.CarCategoryNotValidException">
 /// If the category is not a valid value.
 /// </exception>
 public void ValidateCategory(CarCategory.Category category)
 {
     if (Array.BinarySearch(CarCategory.categories, category) < 0)
     {
         throw new CarCategoryNotValidException(CarCategoryNotValidException.CarCategoryNotValidMsg, category);
     }
 }
 /// <summary>Initializes a new instance of the <see cref="CarSearchCriteria"/> class.</summary>
 /// <param name="categoryFrom">The category from.</param>
 /// <param name="categoryTo">The category to.</param>
 /// <param name="yearFrom">The year from.</param>
 /// <param name="yearTo">The year to.</param>
 /// <param name="maxPowerFrom">The maximum power from.</param>
 /// <param name="maxPowerTo">The maximum power to.</param>
 /// <param name="driveTrain">The drive train.</param>
 /// <param name="manufacturerName">Name of the manufacturer.</param>
 /// <param name="countryDescription">The country description.</param>
 /// <param name="regionDescription">The region description.</param>
 /// <exception cref="ArgumentNullException">
 /// categoryFrom or categoryTo or driveTrain or manufacturerName or countryDescription or regionDescription
 /// </exception>
 public CarSearchCriteria(CarCategory.Category categoryFrom, CarCategory.Category categoryTo, int yearFrom, int yearTo, int maxPowerFrom,
                          int maxPowerTo, string driveTrain, string manufacturerName, string countryDescription, string regionDescription)
 {
     CategoryFrom       = categoryFrom ?? throw new ArgumentNullException(nameof(categoryFrom));
     CategoryTo         = categoryTo ?? throw new ArgumentNullException(nameof(categoryTo));
     YearFrom           = yearFrom;
     YearTo             = yearTo;
     MaxPowerFrom       = maxPowerFrom;
     MaxPowerTo         = maxPowerTo;
     DriveTrain         = driveTrain ?? throw new ArgumentNullException(nameof(driveTrain));
     ManufacturerName   = manufacturerName ?? throw new ArgumentNullException(nameof(manufacturerName));
     CountryDescription = countryDescription ?? throw new ArgumentNullException(nameof(countryDescription));
     RegionDescription  = regionDescription ?? throw new ArgumentNullException(nameof(regionDescription));
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CarCategoryNotValidException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="category">The category.</param>
 public CarCategoryNotValidException(string message, CarCategory.Category category) : base(message)
 {
     Category = category;
 }