public StvoriNovoNatjecanje()
        {
            InitializeComponent();
            var seasonProc       = new SeasonProcessor();
            var organizationProc = new OrganizationProcessor();

            comboBox1.DataSource            = seasonProc.RetrieveCompetitions();
            comboBox2.DataSource            = seasonProc.RetrieveSeasons(DateTime.Now);
            comboBox1.DisplayMember         = "Name";
            comboBox1.ValueMember           = "Id";
            comboBox2.DisplayMember         = "Name";
            comboBox2.ValueMember           = "Id";
            comboBox1.SelectedIndexChanged += SelectedIndexChanged;
            comboBox2.SelectedIndexChanged += SelectedIndexChanged;
            var organizations         = organizationProc.getOrganizations();
            var orglic                = organizationProc.RetrieveOrganizationWithLicence(int.Parse(comboBox2.SelectedValue.ToString()), int.Parse(comboBox1.SelectedValue.ToString()));
            List <Organization> lista = new List <Organization>();

            foreach (var org in organizations)
            {
                if (orglic.Contains(org.Id))
                {
                    lista.Add(org);
                }
            }

            listBox1.DataSource    = lista;
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember   = "Id";
            listBox1.SelectionMode = SelectionMode.MultiExtended;
        }
Beispiel #2
0
 public StvoriNatjecanje()
 {
     InitializeComponent();
     op = new OrganizationProcessor();
     cp = new CompetitionProcessor();
     comboBox1.DataSource    = op.getOrganizations();
     comboBox1.ValueMember   = "Id";
     comboBox1.DisplayMember = "Name";
 }
        private void SelectedIndexChanged(object sender, EventArgs e)
        {
            var organizationProc      = new OrganizationProcessor();
            var organizations         = organizationProc.getOrganizations();
            var orglic                = organizationProc.RetrieveOrganizationWithLicence(int.Parse(comboBox2.SelectedValue.ToString()), int.Parse(comboBox1.SelectedValue.ToString()));
            List <Organization> lista = new List <Organization>();

            foreach (var org in organizations)
            {
                if (orglic.Contains(org.Id))
                {
                    lista.Add(org);
                }
            }
            listBox1.DataSource = lista;
        }
Beispiel #4
0
        public void Validate_GetOrganisations()
        {
            var organizations = new List <Organization>();

            var repository = new Mock <IOrganizationRepository>();

            repository.Setup(x => x.getOrganizations()).Returns(organizations);

            OrganizationProcessor processor = new OrganizationProcessor();

            processor.Repository = (IOrganizationRepository)repository.Object;

            var res = processor.getOrganizations();

            repository.Verify(x => x.getOrganizations(), Times.Exactly(1));
        }