コード例 #1
0
        public void Initialize(PharmacySystemAdapterParameters parameters, HttpClient httpClient)
        {
            var mapperConfig = new MapperConfiguration(cfg => cfg.AddProfile(new PharmacySystemProfile_Id1()));

            _mapper     = new Mapper(mapperConfig);
            _parameters = parameters;
            _api        = new PharmacySystemApi_Id1(_parameters.Url, httpClient);
        }
コード例 #2
0
        public void GetAllDrugs_Invalid_Endpoint()
        {
            SftpConfig sftpConfig = new SftpConfig()
            {
                Host = "192.168.1.4", Port = 22, Password = "******", Username = "******"
            };
            PharmacySystemAdapterParameters parameters = new PharmacySystemAdapterParameters()
            {
                ApiKey = "api", GrpcAdress = new GrpcAdress("localhost", 9080), Url = "http://localhost:8090", HospitalName = "HealthcareSystem-ORG4", SftpConfig = sftpConfig
            };

            _adapter.Initialize(parameters, new HttpClient());

            var ret = _adapter.GetAllDrugs();

            //Assert.True(ret.Count == 0);
        }
コード例 #3
0
        public void DrugAvailibility_Returns_Searched_Drugs_Invalid_Endpoint()
        {
            SftpConfig sftpConfig = new SftpConfig()
            {
                Host = "192.168.1.4", Port = 22, Password = "******", Username = "******"
            };
            PharmacySystemAdapterParameters parameters = new PharmacySystemAdapterParameters()
            {
                ApiKey = "api", GrpcAdress = new GrpcAdress("localhost", 9080), Url = "http://localhost:8090", HospitalName = "HealthcareSystem-ORG4", SftpConfig = sftpConfig
            };

            _adapter.Initialize(parameters, new HttpClient());

            if (_isaRunning)
            {
                var ret = _adapter.DrugAvailibility("brufen");
                Assert.True(ret.Count == 0);
            }
        }
コード例 #4
0
        public void OrderDrugs_Invalid_Drug()
        {
            SftpConfig sftpConfig = new SftpConfig()
            {
                Host = "192.168.1.4", Port = 22, Password = "******", Username = "******"
            };
            PharmacySystemAdapterParameters parameters = new PharmacySystemAdapterParameters()
            {
                ApiKey = "api", GrpcAdress = new GrpcAdress("localhost", 9090), Url = "http://localhost:8080", HospitalName = "HealthcareSystem-ORG4", SftpConfig = sftpConfig
            };

            _adapter.Initialize(parameters, new HttpClient());

            if (_isaRunning)
            {
                var ret = _adapter.OrderDrugs(1, 99, 1);
                Assert.False(ret);
            }
        }
コード例 #5
0
        public void GetDrugSpecifications_Invalid_Specification()
        {
            SftpConfig sftpConfig = new SftpConfig()
            {
                Host = "192.168.1.4", Port = 22, Password = "******", Username = "******"
            };
            PharmacySystemAdapterParameters parameters = new PharmacySystemAdapterParameters()
            {
                ApiKey = "api", GrpcAdress = new GrpcAdress("localhost", 9090), Url = "http://localhost:8080", HospitalName = "HealthcareSystem-ORG4", SftpConfig = sftpConfig
            };

            _adapter.Initialize(parameters, new HttpClient());
            System.IO.Directory.CreateDirectory("Resources");

            if (_isaRunning)
            {
                var ret = _adapter.GetDrugSpecifications(99);
                Assert.False(ret);
            }
        }
コード例 #6
0
        public void SendDrugConsumptionReport_Valid_Endpoint()
        {
            SftpConfig sftpConfig = new SftpConfig()
            {
                Host = "192.168.1.4", Port = 22, Password = "******", Username = "******"
            };
            PharmacySystemAdapterParameters parameters = new PharmacySystemAdapterParameters()
            {
                ApiKey = "api", GrpcAdress = new GrpcAdress("localhost", 9090), Url = "http://localhost:8080", HospitalName = "HealthcareSystem-ORG4", SftpConfig = sftpConfig
            };

            _adapter.Initialize(parameters, new HttpClient());
            System.IO.Directory.CreateDirectory("Resources");
            using (StreamWriter sw = File.CreateText("Resources/report.txt"))
            {
                sw.WriteLine("report test");
            }

            if (_isaRunning)
            {
                var ret = _adapter.SendDrugConsumptionReport("Resources", "report.txt");
                Assert.True(ret);
            }
        }