public void TestStaticService()
        {
            IDataBaseService                  iDataBaseService   = new DataBaseService();
            StaticDataServices                staticDataService  = new StaticDataServices(iDataBaseService);
            IEnumerable <City>                cityList           = staticDataService.GetCity();
            IEnumerable <Country>             countryList        = staticDataService.GetCountry();
            IEnumerable <State>               stateList          = staticDataService.GetState();
            IEnumerable <HospitalModel>       hospitalList       = staticDataService.GetHospital();
            IEnumerable <DeseaseModel>        deseaseList        = staticDataService.GetDesease();
            IEnumerable <SpecializationModel> specializationList = staticDataService.GetSpecialization();

            Assert.IsNotNull(cityList);
            Assert.IsNotNull(countryList);
            Assert.IsNotNull(stateList);
            Assert.IsNotNull(hospitalList);
            Assert.IsNotNull(deseaseList);
            Assert.IsNotNull(specializationList);
        }
 public UserViewModel CreateUserViewModel()
 {
     return(new UserViewModel(staticDataServices.GetCountry(), staticDataServices.GetState(), staticDataServices.GetCity()));
 }
Exemplo n.º 3
0
        public void TestSaveUser()
        {
            IDataBaseService   iDataBaseService  = new DataBaseService();
            UserService        uService          = new UserService(iDataBaseService);
            StaticDataServices staticDataService = new StaticDataServices(iDataBaseService);
            ILogger            logger            = new Logger(iDataBaseService);

            DataServices.DataServices dServ   = new DataServices.DataServices(iDataBaseService);
            ViewModelFactory          factory = new ViewModelFactory(dServ, staticDataService);
            UserMapper     uMapper            = new UserMapper(factory);
            OtpMapper      oMapper            = new OtpMapper(factory);
            DoctorMapper   doctorMapper       = new DoctorMapper(factory);
            UserController uController        = new UserController(staticDataService, dServ, factory, uMapper, doctorMapper, oMapper, logger);

            uController.Request = new HttpRequestMessage
            {
                RequestUri = new Uri("http://localhost/User/SaveUser")
            };
            uController.Configuration = new HttpConfiguration();
            uController.Configuration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

            uController.RequestContext.RouteData = new HttpRouteData(
                route: new HttpRoute(),
                values: new HttpRouteValueDictionary {
                { "controller", "user" }
            });

            RequestCarrier req = new RequestCarrier();

            req.From     = "Test";
            req.TanentId = -1;

            UserViewModel dvModel = new UserViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity());

            dvModel.Id                = 6;
            dvModel.Email             = "*****@*****.**";
            dvModel.Password          = "******";
            dvModel.FirstName         = "Shubham";
            dvModel.LastName          = "Joshi";
            dvModel.CreatedByEntity   = 1;
            dvModel.PhoneNumber       = "8968574635";
            dvModel.IsPhoneNoVerified = false;
            dvModel.IsDeleted         = false;
            dvModel.TanentId          = -1;
            dvModel.CreatedBy         = 1;
            //dvModel.UpdatedBy = 1;
            req.PayLoad = dvModel;
            var response = uController.SaveUser(req);

            Assert.IsNotNull(response);
        }
Exemplo n.º 4
0
        public void TestGetUser()
        {
            IDataBaseService   iDataBaseService  = new DataBaseService();
            UserService        uService          = new UserService(iDataBaseService);
            StaticDataServices staticDataService = new StaticDataServices(iDataBaseService);
            ILogger            logger            = new Logger(iDataBaseService);

            DataServices.DataServices dServ   = new DataServices.DataServices(iDataBaseService);
            ViewModelFactory          factory = new ViewModelFactory(dServ, staticDataService);
            UserMapper     uMapper            = new UserMapper(factory);
            OtpMapper      oMapper            = new OtpMapper(factory);
            DoctorMapper   doctorMapper       = new DoctorMapper(factory);
            UserController uController        = new UserController(staticDataService, dServ, factory, uMapper, doctorMapper, oMapper, logger);

            uController.Request = new HttpRequestMessage
            {
                RequestUri = new Uri("http://localhost/User/GetUser")
            };

            uController.Configuration = new HttpConfiguration();
            uController.Configuration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

            uController.RequestContext.RouteData = new HttpRouteData(
                route: new HttpRoute(),
                values: new HttpRouteValueDictionary {
                { "controller", "user" }
            });

            RequestCarrier req = new RequestCarrier();

            req.From     = "Test";
            req.TanentId = -1;
            UserViewModel uvModel = new UserViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity());

            uvModel.Id  = 3;
            req.PayLoad = uvModel;
            var response = uController.GetUser(req);
        }
        public void TestUpdateDoctor()
        {
            IDataBaseService   iDataBaseService  = new DataBaseService();
            DoctorService      dService          = new DoctorService(iDataBaseService);
            StaticDataServices staticDataService = new StaticDataServices(iDataBaseService);
            ILogger            logger            = new Logger(iDataBaseService);

            DataServices.DataServices dServ   = new DataServices.DataServices(iDataBaseService);
            ViewModelFactory          factory = new ViewModelFactory(dServ, staticDataService);
            DoctorMapper     dMapper          = new DoctorMapper(factory);
            DoctorController dController      = new DoctorController(staticDataService, dServ, factory, dMapper, logger);

            dController.Request = new HttpRequestMessage
            {
                RequestUri = new Uri("http://localhost/Doctor/SaveDoctor")
            };
            dController.Configuration = new HttpConfiguration();
            dController.Configuration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

            dController.RequestContext.RouteData = new HttpRouteData(
                route: new HttpRoute(),
                values: new HttpRouteValueDictionary {
                { "controller", "doctor" }
            });

            RequestCarrier req = new RequestCarrier();

            req.From     = "Test";
            req.TanentId = -1;

            DoctorViewModel dvModel = new DoctorViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity(), staticDataService.GetHospital(), staticDataService.GetDegree(), staticDataService.GetSpecialization(), staticDataService.GetDesease());

            dvModel.Id                   = 8;
            dvModel.Address1             = "12, DP Pharma Road";
            dvModel.CityID               = 1;
            dvModel.CreatedBy            = 1;
            dvModel.CreatedByEntity      = 1;
            dvModel.DoctorDegree         = new List <int>();
            dvModel.DoctorDesease        = new List <int>();
            dvModel.DoctorHospital       = new List <int>();
            dvModel.DoctorSpecialization = new List <int>();
            dvModel.EmailAddress         = "*****@*****.**";
            dvModel.FirstName            = "Raj";
            dvModel.LastName             = "Sharma";
            dvModel.OtherInformation     = "Heart Specilist";
            dvModel.PhoneNumber          = "8989889889";
            dvModel.Pincode              = "411014";
            dvModel.ProfilePhotoID       = 1;
            dvModel.RegistrationNumber   = "RJ12123";
            dvModel.TanentId             = -1;
            //dvModel.UpdatedBy = 1;
            req.PayLoad = dvModel;
            var response = dController.SaveDoctor(req);

            Assert.IsNotNull(response);
        }
        public void TestGetDoctor()
        {
            IDataBaseService   iDataBaseService  = new DataBaseService();
            DoctorService      dService          = new DoctorService(iDataBaseService);
            StaticDataServices staticDataService = new StaticDataServices(iDataBaseService);
            ILogger            logger            = new Logger(iDataBaseService);

            DataServices.DataServices dServ   = new DataServices.DataServices(iDataBaseService);
            ViewModelFactory          factory = new ViewModelFactory(dServ, staticDataService);
            DoctorMapper     dMapper          = new DoctorMapper(factory);
            DoctorController dController      = new DoctorController(staticDataService, dServ, factory, dMapper, logger);

            dController.Request = new HttpRequestMessage
            {
                RequestUri = new Uri("http://localhost/Doctor/GetDoctor")
            };

            dController.Configuration = new HttpConfiguration();
            dController.Configuration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

            dController.RequestContext.RouteData = new HttpRouteData(
                route: new HttpRoute(),
                values: new HttpRouteValueDictionary {
                { "controller", "doctor" }
            });

            RequestCarrier req = new RequestCarrier();

            req.From     = "Test";
            req.TanentId = -1;
            DoctorViewModel dvModel = new DoctorViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity(), staticDataService.GetHospital(), staticDataService.GetDegree(), staticDataService.GetSpecialization(), staticDataService.GetDesease());

            dvModel.Id  = 8;
            req.PayLoad = dvModel;
            var response = dController.GetDoctor(req);
        }