public async void Successfully_registers_api()
        {
            var pharmacy   = CreatePharmacy.CreateValidTestObject();
            var controller = GetPharmacyController();

            var result = await controller.ApiRegister(new PharmacySystemDTO { Name = pharmacy.Name, ApiKey = pharmacy.ApiKey, Url = pharmacy.Url });

            Assert.IsType <RedirectToActionResult>(result);
        }
Ejemplo n.º 2
0
        private PharmacyController GetPharmacyController()
        {
            var pharmacy = CreatePharmacy.CreateValidTestObject();

            pharmacy.Id = 1;
            PharmacySystem pharmacyNull        = null;
            var            pharmacyServiceMock = new Mock <IPharmacySystemService>();

            pharmacyServiceMock.Setup(p => p.Get(It.Is <int>(i => i == 1))).Returns(Task.Run(() => pharmacy));
            pharmacyServiceMock.Setup(p => p.Get(It.Is <int>(i => i != 1))).Returns(Task.Run(() => pharmacyNull));

            return(new PharmacyController(pharmacyServiceMock.Object));
        }