Esempio n. 1
0
        private void AddCertificates()
        {
            var allCitizens = citizenUserRepository.GetUsersAsQueryable();

            // Ensure that all citizens have a birth certificate.
            AddIfNotExistCertificateToCitizens(allCitizens, "Birth Certificate");

            // Ensure that 5 citizens have a diploma.
            var citizenLoginsWithDiploma = new List <string> {
                "Bill", "Musk", "Stroustrup", "Tsoi", "Chuck"
            };
            var citizenWithDiploma = citizenUserRepository.GetUsersByLogins(citizenLoginsWithDiploma);

            AddIfNotExistCertificateToCitizens(citizenWithDiploma, "Diploma of Higher Education");

            // Ensure that citizens have a policeman certificate.
            var citizenLoginsWithPoliceCertificate = new List <string> {
                "Chuck"
            };
            var policemen = citizenUserRepository.GetUsersByLogins(citizenLoginsWithPoliceCertificate);

            AddIfNotExistCertificateToCitizens(policemen, "Policeman Certificate");

            // Ensure that citizens have a doctor certificate.
            var citizenLoginsWithDoctorCertificate = new List <string> {
                "Tsoi"
            };
            var doctors = citizenUserRepository.GetUsersByLogins(citizenLoginsWithDoctorCertificate);

            AddIfNotExistCertificateToCitizens(doctors, "Doctor Certificate");
        }