Exemplo n.º 1
0
 private void GenerateArchitects(int amount, DateTime insertData)
 {
     for (var i = 0; i < amount; i++)
     {
         Architects.Add(new Architect(Architects.Count + 1, insertData, _expirationDate));
     }
 }
Exemplo n.º 2
0
        private void UpdateCanSupervise(DateTime currentDate)
        {
            var amount             = _rand.Next(1, 4);
            var architectsToUpdate = GetArchitectsToUpdate(amount);

            architectsToUpdate.ForEach(architect =>
            {
                var updatedArchitect          = architect.Copy();
                updatedArchitect.CanSupervise = !updatedArchitect.CanSupervise;
                updatedArchitect.InsertDate   = currentDate;
                updatedArchitect.Id           = Architects.Count();
                Architects.Add(updatedArchitect);
                IdMapper.Add(architect.Id, updatedArchitect.Id);
                DeactivateArchitect(currentDate, architect);
            });
        }
Exemplo n.º 3
0
        private void UpdateSpecializationOfArchitect(DateTime currentDate, Architect architect, ICollection <Architect> updatedArchitects)
        {
            var updatedArchitect = architect.Copy();

            updatedArchitect.InsertDate     = currentDate;
            updatedArchitect.Specialization = updatedArchitect.Specialization switch
            {
                OBIEKT_BIUROWY => _rand.Next() % 2 == 0 ? OBIEKT_MIESZKALNY : OBIEKT_USLUGOWY,
                OBIEKT_MIESZKALNY => _rand.Next() % 2 == 0 ? OBIEKT_BIUROWY : OBIEKT_USLUGOWY,
                OBIEKT_USLUGOWY => _rand.Next() % 2 == 0 ? OBIEKT_MIESZKALNY : OBIEKT_BIUROWY,
                _ => throw new ArgumentOutOfRangeException()
            };

            updatedArchitect.Id = Architects.Count();
            Architects.Add(updatedArchitect);
            updatedArchitects.Add(updatedArchitect);
            architect.Active         = false;
            architect.ExpirationDate = currentDate;
            IdMapper.Add(architect.Id, updatedArchitect.Id);
        }