public void creates_no_registration() { RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository()); RegistrationInPharmacy registrationInPharmacy = service.createIRegistration(new RegistrationInPharmacyDto(33, "apisa12345", "Jankovic", "NS")); registrationInPharmacy.ShouldBeNull(); }
public void Find_no_registration() { RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository()); RegistrationInPharmacy foundRegistration = service.getPharmacyApiKey("apisa99"); foundRegistration.ShouldBeNull(); }
public void creates_registration() { RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository()); RegistrationInPharmacy registrationInPharmacy = service.createIRegistration(new RegistrationInPharmacyDto(3, "ffafsfa", "Jankovic", "Bg")); registrationInPharmacy.ShouldNotBeNull(); }
public void Find_registration() { RegistrationInPharmacyService service = new RegistrationInPharmacyService(Create_stub_repository()); RegistrationInPharmacy foundRegistration = service.getPharmacyApiKey("apisa12345"); Assert.NotNull(foundRegistration); }
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)); } }
public RegistrationInPharmacy Create(RegistrationInPharmacyDto dto) { RegistrationInPharmacy registration = RegistrationInPharmacyAdapter.RegistrationDtoToRegistration(dto); if (isApiKeyUnique(registration.ApiKey)) { return(RegistrationInPharmacyRepository.Create(registration)); } return(null); }
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); } }
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); } }
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); } }
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); }
public RegistrationInPharmacy Create(RegistrationInPharmacy registration) { dbContext.Registrations.Add(registration); dbContext.SaveChanges(); return(registration); }
public static RegistrationInPharmacyDto RegistrationToRegistrationDto(RegistrationInPharmacy registration) { return(new RegistrationInPharmacyDto(registration.PharmacyId, registration.ApiKey, registration.Name, registration.Town)); }