Example #1
0
 private void AddWagonForm_Load(object sender, System.EventArgs e)
 {
     this.label_error.ForeColor = Color.Transparent;
     WagonController.FeedComboBox(station_combo_box);
     this.wagon_controller.FeedDataGrid(station_datagrid);
     AddLinkColumnAndName();
 }
Example #2
0
        public async void GetWagon_ReturnsNotFoundResult_WhenWagonIsNotFound()
        {
            // Arrange
            var wagonService    = Substitute.For <IWagonService>();
            var wagonController = new WagonController(wagonService);

            var wagonId = 1;

            wagonService.GetWagonAsync(wagonId).Returns(Task.FromResult <WagonModel>(null));

            // Act
            var result = await wagonController.GetWagonAsync(wagonId);

            // Assert
            Assert.IsType <NotFoundResult>(result.Result);
        }
Example #3
0
 private void btnAdd_Click(object sender, System.EventArgs e)
 {
     this.patent          = this.input_patent.Text;
     this.shipload_weight = this.input_shipload_w.Text;
     this.shipload_type   = this.input_shipload_type.Text;
     this.wagon_weight    = this.input_wagon_w.Text;
     if (this.shipload_weight != "" && this.shipload_type != "" && this.wagon_weight != "")
     {
         if (WagonController.IsNumber(this.shipload_weight))
         {
             if (WagonController.IsNumber(this.wagon_weight))
             {
                 if (!this.wagon_controller.RepeatedPatent(this.patent))
                 {
                     int station_id = Convert.ToInt32(station_combo_box.SelectedValue);
                     if (this.wagon_controller.IsThereSpace(station_id))
                     {
                         this.label_error.ForeColor = Color.Transparent;
                         this.wagon_controller.AddListWagon(this.patent, this.shipload_weight, this.wagon_weight, this.shipload_type, station_id);
                         this.wagon_controller.FeedDataGrid(station_datagrid);
                         ClearAllBoxText();
                     }
                     else
                     {
                         Error("Estación sin Capacidad");
                     }
                 }
                 else
                 {
                     Error("Patente Ingresada.");
                 }
             }
             else
             {
                 Error("Campo Peso Tipo Numérico.");
             }
         }
         else
         {
             Error("Campo Peso Numerico.");
         }
     }
     else
     {
         Error("Error, Campo Vacío.");
     }
 }
Example #4
0
        public async void GetWagon_ReturnsOkResult_WhenWagonIsFound()
        {
            // Arrange
            var wagonService    = Substitute.For <IWagonService>();
            var wagonController = new WagonController(wagonService);

            var wagon = new WagonModel
            {
                WagonId        = 1,
                NumberOfChairs = 2,
                Chairs         = null
            };

            wagonService.GetWagonAsync(wagon.WagonId).Returns(Task.FromResult <WagonModel>(wagon));

            // Act
            var result = await wagonController.GetWagonAsync(wagon.WagonId);

            // Assert
            Assert.IsType <OkObjectResult>(result.Result);
        }
Example #5
0
 public AddWagonForm()
 {
     this.wagon_controller = new WagonController();
     InitializeComponent();
 }