public void A_TestGetContrat()
        {
            List <Contrat> expected = new List <Contrat>();

            expected.Add(new Contrat {
                Type = "CDD"
            });
            expected.Add(new Contrat {
                Type = "CDI"
            });
            expected.Add(new Contrat {
                Type = "Stage"
            });
            expected.Add(new Contrat {
                Type = "Alternance"
            });

            List <Contrat> actual = new List <Contrat>();

            actual.AddRange(testControler.GetContrat());

            Assert.AreSame(expected.ToString(), actual.ToString());

            CollectionAssert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Affiche et type les colonnes de données
        /// </summary>
        private void InitializeForm()
        {
            List <string> Labels = new List <string>()
            {
                "Titre", "Description", "Région", "Type de Contrat", "Type de Poste", "Date Publication", "Lien"
            };
            int i = 0;

            foreach (string label in Labels)
            {
                Label label_UI = new Label()
                {
                    Text = label + " :"
                };
                label_UI.Dock = DockStyle.Top;

                Control control = new TextBox();
                if (label == "Date Publication")
                {
                    control = new DateTimePicker();
                }
                else if (label == "Type de Poste" || label == "Type de Contrat" || label == "Région")
                {
                    BindingSource bs = new BindingSource();

                    control = new ComboBox();
                    ((ComboBox)control).DataSource    = bs;
                    ((ComboBox)control).DisplayMember = "Name";
                    ((ComboBox)control).ValueMember   = "Id";
                    if (label == "Type de Poste")
                    {
                        bs.DataSource = controller.GetPoste();
                    }
                    else if (label == "Type de Contrat")
                    {
                        bs.DataSource = controller.GetContrat();
                    }
                    else if (label == "Région")
                    {
                        bs.DataSource = controller.GetRegion();
                    }
                    else
                    {
                        bs.DataSource = controller.GetOffres();
                    }

                    //((ComboBox)control).SelectedText = null;
                    //((ComboBox)control).SelectionLength = 0;
                    //((ComboBox)control).
                }

                formControls.Add(label, control);
                control.Dock = DockStyle.Fill;
                layout.Controls.Add(label_UI, 0, i);
                layout.Controls.Add(control, 1, i);
                i++;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Rafraichi la source des Contrats
        /// </summary>
        private void RefreshSourceContrat()
        {
            List <Contrat> contrat = new List <Contrat>();

            contrat.Add(new Contrat()
            {
                Id = null, Type = "ALL - Contrats"
            });
            contrat.AddRange(controller.GetContrat());
            contratSource.DataSource = contrat;
        }