コード例 #1
0
        public void creates_no_registration()
        {
            RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository());

            RegistrationInPharmacy registrationInPharmacy = service.createIRegistration(new RegistrationInPharmacyDto(33, "apisa12345", "Jankovic", "NS"));

            registrationInPharmacy.ShouldBeNull();
        }
コード例 #2
0
        public void Find_no_registration()
        {
            RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository());

            RegistrationInPharmacy foundRegistration = service.getPharmacyApiKey("apisa99");

            foundRegistration.ShouldBeNull();
        }
コード例 #3
0
        public void creates_registration()
        {
            RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository());

            RegistrationInPharmacy registrationInPharmacy = service.createIRegistration(new RegistrationInPharmacyDto(3, "ffafsfa", "Jankovic", "Bg"));

            registrationInPharmacy.ShouldNotBeNull();
        }
コード例 #4
0
        public void Find_registration()
        {
            RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository());

            RegistrationInPharmacy foundRegistration = service.getPharmacyApiKey("apisa12345");

            Assert.NotNull(foundRegistration);
        }
コード例 #5
0
        private void UrgentOrderForHttps(string medicine, List <string> pharmacies, RegistrationInPharmacy registrationInPharmacy)
        {
            IPharmacy ipharmacy = PharmacyFactoryHttp.GetIPharmacy(Context);

            if (!ipharmacy.CreateUrgentOrder(medicine).IsNullOrEmpty())
            {
                pharmacies.Add(ipharmacy.CreateUrgentOrder(medicine));
            }
        }
コード例 #6
0
        public RegistrationInPharmacy Create(RegistrationInPharmacyDto dto)
        {
            RegistrationInPharmacy registration = RegistrationInPharmacyAdapter.RegistrationDtoToRegistration(dto);

            if (isApiKeyUnique(registration.ApiKey))
            {
                return(RegistrationInPharmacyRepository.Create(registration));
            }
            return(null);
        }
コード例 #7
0
 private void DefineTypeOfApiKey(EPrescription prescription, RegistrationInPharmacy registrationInPharmacy)
 {
     if (registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Substring(registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Length - 1).Equals("H"))
     {
         new PharmacyHttp(Context).SendPrescription(prescription);
     }
     else
     {
         new PharmacyGrpcSftp(Context).SendPrescription(prescription);
     }
 }
コード例 #8
0
 private void DefineTyepOfApiKey(DateOfOrder date, RegistrationInPharmacy registrationInPharmacy)
 {
     if (registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Substring(registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Length - 1).Equals("H"))
     {
         PharmacyFactoryHttp.GetIPharmacy(Context).SendReport(date);
     }
     else
     {
         PharmacyFactoryGrpcAndSftp.GetIPharmacy(Context).SendReport(date);
     }
 }
コード例 #9
0
 private void DefineTyepOfApiKey(String medicine, List <string> pharmacies, RegistrationInPharmacy registrationInPharmacy)
 {
     if (registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Substring(registrationInPharmacy.PharmacyConnectionInfo.ApiKey.Length - 1).Equals("H"))
     {
         UrgentOrderForHttps(medicine, pharmacies, registrationInPharmacy);
     }
     else
     {
         UrgentOrderForSftpGrpc(medicine, pharmacies);
     }
 }
コード例 #10
0
        public static IRegistrationInPharmacyRepository Create_stub_repository()
        {
            var stubRepository = new Mock <IRegistrationInPharmacyRepository>();
            RegistrationInPharmacy registrationInPharmacy = new RegistrationInPharmacy(4, 5, "apisa12345", "Jankovic 2", "Novi Sad");

            var registrationsInPharmacies = new List <RegistrationInPharmacy>();

            registrationsInPharmacies.Add(registrationInPharmacy);
            stubRepository.Setup(m => m.GetAll()).Returns(registrationsInPharmacies);

            return(stubRepository.Object);
        }
コード例 #11
0
 public RegistrationInPharmacy Create(RegistrationInPharmacy registration)
 {
     dbContext.Registrations.Add(registration);
     dbContext.SaveChanges();
     return(registration);
 }
コード例 #12
0
 public static RegistrationInPharmacyDto RegistrationToRegistrationDto(RegistrationInPharmacy registration)
 {
     return(new RegistrationInPharmacyDto(registration.PharmacyId, registration.ApiKey, registration.Name, registration.Town));
 }