public CertificationBoard(string name, CertificationAgency agency)
     : this()
 {
     if (agency == null)
     {
         throw new ArgumentNullException("agency");
     }
     CertificationAgency = agency;
     SetName(name);
     IsEnabled = true;
 }
        public void can_set_CertificationSpecialty()
        {
            //setup
            var providerCertificationSpecialty = CreateValidProviderCertificationSpecialty();

            var certificationAgency = new CertificationAgency("Different Agency");
            var certificationBoard = certificationAgency.AddCertificationBoard("Different Board");
            var certificationSpecialty = certificationBoard.AddCertificationSpecialty("Different Specialty");

            //act
            providerCertificationSpecialty.SetCertificationSpecialty(certificationSpecialty);

            //assert
            Assert.AreSame(certificationSpecialty, providerCertificationSpecialty.CertificationSpecialty);
        }
        private CertificationSpecialty CreateCertificationSpecialty()
        {
            _certificationAgency = new CertificationAgency("Big Agency");
            _certificationBoard = _certificationAgency.AddCertificationBoard("Medium Board");
            _certificationSpecialty = _certificationBoard.AddCertificationSpecialty("Precise Specialty");

            return _certificationSpecialty;
        }
 public void cannot_construct_with_null_name()
 {
     string name = null;
     var subject = new CertificationAgency(name);
 }
 public void cannot_construct_with_name_too_long()
 {
     var name = new string('*', 101);
     var subject = new CertificationAgency(name);
 }
 public void cannot_construct_with_empty_name()
 {
     var name = "";
     var subject = new CertificationAgency(name);
 }
Beispiel #7
0
        private CertificationSpecialty CreateCertificationSpecialty(string specialtyName)
        {
            _certificationAgency = new CertificationAgency("Big Agency");
            _certificationBoard = _certificationAgency.AddCertificationBoard("Medium Board");
            _certificationSpecialty = _certificationBoard.AddCertificationSpecialty(specialtyName);

            return _certificationSpecialty;
        }
        public static void SetProviderCertificationAgencies(ObjectContext context, ProviderV2 source, Provider provider)
        {
            if (source.CertificationAgencies == null)
                return;

            try
            {
                var existingCertificationSpecialties = provider.ProviderCertificationSpecialties.ToArray();
                foreach (var item in existingCertificationSpecialties)
                    context.DeleteObject(item);

                var providerCertificationSpecialties = new List<ProviderCertificationSpecialty>();

                foreach (var certificationAgency in source.CertificationAgencies)
                {
                    var agencies = context.CreateObjectSet<CertificationAgency>();

                    //Ensure Agency Exists
                    var agency = agencies.FirstOrDefault(s => s.Name == certificationAgency.AgencyName);
                    if (agency == null)
                    {
                        agency = new CertificationAgency(certificationAgency.AgencyName);
                        agencies.AddObject(agency);
                    }

                    foreach (var certificationBoard in certificationAgency.CertificationBoards)
                    {
                        var boards = agency.CertificationBoards;

                        //Ensure Board Exists
                        var board = boards.FirstOrDefault(s => s.Name == certificationBoard.BoardName);
                        if (board == null)
                        {
                            board = agency.AddCertificationBoard(certificationBoard.BoardName);
                        }

                        foreach (var certificationSpecialty in certificationBoard.CertificationSpecialties)
                        {
                            var specialties = board.CertificationSpecialties;

                            //Ensure Specialty Exists
                            var specialty = specialties.FirstOrDefault(s => s.Name == certificationSpecialty.Name);
                            if (specialty == null)
                            {
                                specialty = board.AddCertificationSpecialty(certificationSpecialty.Name);
                                specialty.IsSubspecialty = ConvertToBool(certificationSpecialty.IsSubSpecialty, false, "CertificationSpecialty/IsSubSpecialty", provider.FullName);
                            }

                            providerCertificationSpecialties.Add(new ProviderCertificationSpecialty(provider, specialty, certificationSpecialty.YearOfIssuance));
                        }
                    }
                }

                provider.ProviderCertificationSpecialties = providerCertificationSpecialties;
            }
            catch (Exception ex)
            {
                throw new BusinessException("Error processing certification specialties for provider '" + provider.Name + "' - " + ex.Message, ex);
            }
        }