예제 #1
0
 public void AvailabilityTest()
 {
     var car = new Car(avto, 3);
     car.Cost = 2000;
     car.MaximumNumberOfPassengers = 3;
     Assert.AreEqual(car.Availability,true);
 }
예제 #2
0
 public void SearchCarTest()
 {
     var car = new Car(avto, 0);
     car.Name = "asd";
     car.Cost = 2000;
     car.MaximumNumberOfPassengers = 3;
     Assert.AreEqual(car, avto.SearchCar("asd"));
 }
예제 #3
0
 public void PurchaserNameExceptionTest()
 {
     var car = new Car(avto, 0);
     car.Name = "asd";
     car.Cost = 2000;
     car.MaximumNumberOfPassengers = 3;
     Applications app = new UIApplicationsForDelayedDelivery("", car, 20);
 }
예제 #4
0
 public void CarNumberExceptionTest()
 {
     var car = new Car(avto,0);
     car.Name = "asd";
     car.Cost = 2000;
     car.MaximumNumberOfPassengers = 3;
     Applications app = new UIApplicationsForDelayedDelivery("asd",car,20);
     app.СalculateCost();
 }
예제 #5
0
 public void CalculateCostTest()
 {
     var car = new Car(avto, 3);
     car.Cost = 2000;
     car.MaximumNumberOfPassengers = 3;
     Applications app = new UIApplicationsForDelayedDelivery("asd", car, 20);
     app.СalculateCost();
     Assert.AreEqual(app.СalculateCost(),1600);
 }
예제 #6
0
 protected Applications(string nameOfBuyer,Car car)
 {
     try
     {
         if (string.IsNullOrEmpty(nameOfBuyer)) throw new PurchaserNameException("Неуказано имя покупателя!");
         NameOfBuyer = nameOfBuyer;
     }
     catch (PurchaserNameException ex)
     {
         MessageBox.Show("" + ex);
     }
     Car = car;
     Car.AddApplication(this);
 }
예제 #7
0
 private void CreateCarButton_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(CarNameTextBox.Text)
         && !String.IsNullOrEmpty(CostTextBox.Text)
         && !String.IsNullOrEmpty(NumberOfPassegerTextBox.Text))
     {
         Car = new Car(_saloon, Convert.ToInt32(QuantityInStockTextBox.Text))
             {
                 Name = CarNameTextBox.Text,
                 MaximumNumberOfPassengers = Convert.ToInt32(NumberOfPassegerTextBox.Text),
                 Cost = Convert.ToInt32(CostTextBox.Text)
             };
         DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         MessageBox.Show("Неуказаны необходимые поля.");
     }
 }
 public UIApplicationsInStock(String nameOfBuyer, Car car)
     : base(nameOfBuyer, car)
 {
 }
예제 #9
0
 private void UpdateApplicationListBox(Car car)
 {
     ApplicationListBox.Items.Clear();
     foreach (var application in car.GetApplications())
     {
         ApplicationListBox.Items.Add(application);
     }
 }
 public CreateApplicationForm(Car car)
 {
     _car = car;
     InitializeComponent();
 }
 public UIApplicationsForDelayedDelivery(string nameOfBuyers,Car car,int percent)
     : base(nameOfBuyers,car)
 {
     SalePercent = percent;
 }
예제 #12
0
 public void RemoveCar(Car car)
 {
     _cars.Remove(car);
 }
예제 #13
0
 public void AddCar(Car car)
 {
     _cars.Add(car);
 }