Beispiel #1
0
        public void Add_to_Group()
        {
            var _group = new GenericGroup <object>("FakeName", t => true);

            _group.Add(new object());
            Assert.Single(_group.Items);
        }
Beispiel #2
0
        public async Task <IActionResult> AddGroup(GenericGroup item)
        {
            _context.GenericGroups.Add(item);
            await _context.SaveChangesAsync();

            return(RedirectToAction("GroupsList"));
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GenericGroup genericGroup = new GenericGroup();

            if (!DA.GetData(0, ref genericGroup))
            {
                return;
            }

            DA.SetDataList(0, genericGroup.GetList());
        }
Beispiel #4
0
        public void Transform_The_Elements_Of_the_Group()
        {
            var group1 = new GenericGroup <object>("string", t => t is string);

            group1.Add("1");


            IGroup <int> group = group1.Transform((t) => int.Parse(t.ToString()), t => t.ToString());

            Assert.Equal(1, group.Items.First());
        }
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <object> list = new List <object>();

            if (!DA.GetDataList(0, list))
            {
                return;
            }

            GenericGroup genericGroup = new GenericGroup(list);

            DA.SetData(0, genericGroup);
        }
Beispiel #6
0
 public void SetFacultyGroups(string facultyName, GenericGroup group)
 {
     dal.SetFacultyGroups(facultyName, group);
 }
Beispiel #7
0
 public void SetFacultyGroups(string facultyName, GenericGroup group)
 {
     var findOneByIdAs = UsersCollection.Collection.FindOneByIdAs<Faculty>(facultyName);
     findOneByIdAs.Groups = group;
     UsersCollection.Collection.Save(findOneByIdAs);
 }
Beispiel #8
0
        public void Throw_FileNotBelongsToTheGroupException_if_isnt_a_Xml()
        {
            var _group = new GenericGroup <object>("FakeName", t => false);

            Assert.Throws <ItemNotBelongsToTheGroupException>(() => _group.Add(new object()));
        }
Beispiel #9
0
        public void Returns_expectedResult_with_when_verify_an_item_with_rule(int item, int rule, bool expectedResult)
        {
            var genericGroup = new GenericGroup <int>("integer group", t => t == rule);

            Assert.True(genericGroup.IsBelong(item) == expectedResult);
        }
Beispiel #10
0
        public void ShouldSetFIIFacultyGroups()
        {
            var bl = new UsersBL();
            var fullFaculty = new GenericGroup("FII");
            fullFaculty.Groups = new List<GenericGroup>();

            #region Bachelor
            var bachelor1 = new GenericGroup("I1");
            var bachelor1A = new GenericGroup("I1A");
            var bachelor1B = new GenericGroup("I1B");
            bachelor1A.Groups = new List<GenericGroup>();
            bachelor1B.Groups = new List<GenericGroup>();
            for (int i = 1; i < 8; i++)
            {
                bachelor1A.Groups.Add(new GenericGroup("I1A" + i));
                bachelor1B.Groups.Add(new GenericGroup("I1B" + i));
            }
            bachelor1.Groups.Add(bachelor1A);
            bachelor1.Groups.Add(bachelor1B);

            var bachelor2 = new GenericGroup("I2");
            var bachelor2A = new GenericGroup("I2A");
            var bachelor2B = new GenericGroup("I2B");
            bachelor2A.Groups = new List<GenericGroup>();
            bachelor2B.Groups = new List<GenericGroup>();
            for (int i = 1; i < 8; i++)
            {
                bachelor2A.Groups.Add(new GenericGroup("I2A" + i));
                bachelor2B.Groups.Add(new GenericGroup("I2B" + i));
            }
            bachelor2.Groups.Add(bachelor2A);
            bachelor2.Groups.Add(bachelor2B);

            var bachelor3 = new GenericGroup("I3");
            var bachelor3A = new GenericGroup("I3A");
            var bachelor3B = new GenericGroup("I3B");
            bachelor3A.Groups = new List<GenericGroup>();
            bachelor3B.Groups = new List<GenericGroup>();
            for (int i = 1; i < 6; i++)
            {
                bachelor3A.Groups.Add(new GenericGroup("I3A" + i));
                bachelor3B.Groups.Add(new GenericGroup("I3B" + i));
            }
            bachelor3.Groups.Add(bachelor3B);
            bachelor3.Groups.Add(bachelor3B);

            fullFaculty.Groups.Add(bachelor1);
            fullFaculty.Groups.Add(bachelor2);
            fullFaculty.Groups.Add(bachelor3);
            #endregion

            #region Masters
            var mis1 = new GenericGroup("MIS1");
            mis1.Groups.Add(new GenericGroup("MIS11"));
            mis1.Groups.Add(new GenericGroup("MIS12"));
            var mis2 = new GenericGroup("MIS2");
            mis2.Groups.Add(new GenericGroup("MIS21"));
            mis2.Groups.Add(new GenericGroup("MIS22"));

            var mlc1 = new GenericGroup("MLC1");
            var mlc2 = new GenericGroup("MLC2");

            var moc1 = new GenericGroup("MOC1");
            var moc2 = new GenericGroup("MOC2");

            var msd1 = new GenericGroup("MSD1");
            var msd2 = new GenericGroup("MSD2");

            var msi1 = new GenericGroup("MSI1");
            var msi2 = new GenericGroup("MSI2");

            fullFaculty.Groups.Add(mis1);
            fullFaculty.Groups.Add(mis2);
            fullFaculty.Groups.Add(mlc1);
            fullFaculty.Groups.Add(mlc2);
            fullFaculty.Groups.Add(moc1);
            fullFaculty.Groups.Add(moc2);
            fullFaculty.Groups.Add(msd1);
            fullFaculty.Groups.Add(msd2);
            fullFaculty.Groups.Add(msi1);
            fullFaculty.Groups.Add(msi2);
            #endregion

            bl.SetFacultyGroups("info.uaic.ro", fullFaculty);
        }