public void TesAddAppointmentExtemporanea() { AutoMapperBootStrapper.ConfigureAutoMapper(); var mockRepoPatient = new Mock <IPatientRepository>(); var mockRepoAppointment = new Mock <IAppointmentRepository>(); var mockUO = new Mock <IUnitOfWork>(); var mockLog = new Mock <ILogger <AppointmentService> >(); mockRepoAppointment.Setup(p => p.Add(new Appointment())); IAppointmentService servicce = new AppointmentService(mockRepoAppointment.Object, mockUO.Object, mockLog.Object, mockRepoPatient.Object); var result = servicce.Add(new ContractRequest <AddUpdateAppointmentRequest> { Data = new AddUpdateAppointmentRequest { Appointment = new AppointmentView { AppointmentDate = DateTime.Now, AppointmentTypeId = 1, PatientId = 1 } } }); Assert.AreEqual(true, result.ErrorMessages.Any()); Assert.AreEqual("Las citas se deben agendar con mínimo 24 horas de antelación.", result.ErrorMessages[0]); }
private List <AnswerModel> GetAnswers(int questionId) { var answerList = new List <Answer>(); //var questionToReturn = new Question(); var answerModelList = new List <AnswerModel>(); using (var db = new ChatdataEntities()) { try { answerList = (from Answer in db.Answers where Answer.QuestionId == questionId select Answer) .ToList(); } catch (Exception ex) { var foo = ex.Message; } if (answerList.Count > 0) { var autoMapper = AutoMapperBootStrapper.GetMapper(); answerModelList = autoMapper.Map <List <Answer>, List <AnswerModel> >(answerList); } } return(answerModelList); }
protected void Application_Start() { //加载控制反转 BootStrapper.ConfigureDependencies(); //区域 AreaRegistration.RegisterAllAreas(); //配置调用WebApi借口 WebApiConfig.Register(GlobalConfiguration.Configuration); //过滤器 FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); //加载路由 RouteConfig.RegisterRoutes(RouteTable.Routes); //加载JS/CSS文件 BundleConfig.RegisterBundles(BundleTable.Bundles); //加载Mapper AutoMapperBootStrapper.ConfigureAutoMapper(); //配置文件 ApplicationSettingsFactory.InitializeApplicationSettingsFactory(ObjectFactory.GetInstance <IApplicationSettings>()); //验证方法 AuthenticationFactory.InitializeAuthenticationFactory(ObjectFactory.GetInstance <IAuthenticationService>()); // ControllerBuilder.Current.SetControllerFactory(new WangYc.Controllers.IocControllerFactory()); //日志 LoggingFactory.InitializeLogFactory(ObjectFactory.GetInstance <ILogger>()); LoggingFactory.GetLogger().Log("Application Started"); //删除xml的解析 当返回值是string 时 直接返回string不是json对象 GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { AutoMapperBootStrapper.ConfigureAutoMapper(); services.AddScoped(typeof(IProductService), typeof(ProductService)); services.AddMvc(); }
public ProductTest() { IUnitOfWork uow = new NHUnitOfWork(); this._productRsponstroy = new ProductRepository(uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationMainDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationMainDbContext>() .AddDefaultTokenProviders(); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); //Dependencie Injection services.AddScoped(typeof(IRepository <>), typeof(Repository <>)); services.AddTransient <IPatientService, PatientService>(); AutoMapperBootStrapper.RegisterMappings(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
public WarehouseTest() { IUnitOfWork uow = new NHUnitOfWork(); this._warehouseRsponstroy = new WarehouseRepository(uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
public void TesAddAppointment() { AutoMapperBootStrapper.ConfigureAutoMapper(); var mockRepoPatient = new Mock <IPatientRepository>(); var mockRepoAppointment = new Mock <IAppointmentRepository>(); var mockUO = new Mock <IUnitOfWork>(); var mockLog = new Mock <ILogger <AppointmentService> >(); mockRepoAppointment.Setup(p => p.Add(new Appointment())); IAppointmentService servicce = new AppointmentService(mockRepoAppointment.Object, mockUO.Object, mockLog.Object, mockRepoPatient.Object); var result = servicce.Add(new ContractRequest <AddUpdateAppointmentRequest> { Data = new AddUpdateAppointmentRequest { Appointment = new AppointmentView { AppointmentDate = DateTime.Now.AddDays(3), AppointmentTypeId = 1, PatientId = 1 } } }); Assert.AreNotEqual(null, result.Data); Assert.AreEqual(true, result.Data.Any()); Assert.AreEqual(false, result.ErrorMessages.Any()); }
public RightsServiceTest() { IUnitOfWork uow = new NHUnitOfWork(); IRightsRepository _rightsRepository = new RightsRepository(uow); this._rightsService = new RightsService(_rightsRepository, uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); DependencyResolver.SetResolver(new Infrastructure.NinjectDependencyResolver()); AutoMapperBootStrapper.ConfigureAutoMapper(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); UnityConfig.RegisterComponents(); AutoMapperBootStrapper.Initialize(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
protected void Application_Start() { AutoMapperBootStrapper.BootStrap(); GlobalConfiguration.Configure(WebApiConfig.Register); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
/// <summary> /// Creates a <see cref="T:System.ServiceModel.ServiceHost" /> for a specified type of service with a specific base address. /// </summary> /// <param name="serviceType">Specifies the type of service to host.</param> /// <param name="baseAddresses">The <see cref="T:System.Array" /> of type <see cref="T:System.Uri" /> that contains the base addresses for the service hosted.</param> /// <returns> /// A <see cref="T:System.ServiceModel.ServiceHost" /> for the type of service specified with a specific base address. /// </returns> protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses) { AutoMapperBootStrapper.ConfigureAutoMapper(); var container = UnityBootStrapper.GetUnityConfiguration(); var serviceHost = new SaltServiceHost(container, serviceType, baseAddresses); return(serviceHost); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); AutoMapperBootStrapper.Configure(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperBootStrapper.Start(); ControllerBuilder.Current.SetControllerFactory(new UnityControllerFactory()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperBootStrapper.BootStrap(); AutoMapperBootStrapper.Configure(System.Web.Mvc.DependencyResolver.Current .GetServices(typeof(IAutoMapperTypeConfigurator)).Cast <IAutoMapperTypeConfigurator>()); }
public UsersServiceTest() { IUnitOfWork uow = new NHUnitOfWork(); IUsersRepository _usersRepository = new UsersRepository(uow); IOrganizationRepository _organizationRepository = new OrganizationRepository(uow); this._userService = new UsersService(_usersRepository, _organizationRepository, uow); this._organizationService = new OrganizationService(_organizationRepository, uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
protected void Application_Start() { GlobalConfiguration.Configure(x => { WebApiConfig.Register(x); x.Filters.Add(new ExceptionFilter()); x.Filters.Add(new StoreAuthorizeFilter()); }); AutofacBoot.Init(); AutoMapperBootStrapper.ConfigureAutoMapper(); Boot.Init(); }
public AddressModelTests() { AutoMapperBootStrapper.CreateMapperConfiguration(); IOptions <SiteDbContext> dataBaseConfig = new OptionsManager <SiteDbContext>(new IConfigureOptions <SiteDbContext> [0]); dataBaseConfig.Value.DefaultConnectionString = @"Data Source=haw.trustteam.be,41433; Initial Catalog=bocotransapp; Integrated Security=false;User ID =sa;Password=abit@complicated35; MultipleActiveResultSets=True"; IUnitOfWork unitOfWork = new UnitOfWork(dataBaseConfig); _addressesService = new AddressesService(unitOfWork, null); }
public InOutBoundTest() { IUnitOfWork uow = new NHUnitOfWork(); this._outBoundRsponstroy = new OutBoundRepository(uow); this._inBoundRsponstroy = new InBoundRepository(uow); this._inOutBoundRsponstroy = new InOutBoundRepository(uow); this._productRepository = new ProductRepository(uow); this._warehouseRepository = new WarehouseRepository(uow); this._warehouseShelfRepository = new WarehouseShelfRepository(uow); this._inOutBoundService = new InOutBoundService(_inOutBoundRsponstroy, _outBoundRsponstroy, _inBoundRsponstroy, _productRepository, _warehouseRepository, _warehouseShelfRepository, uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
public SupplierTests() { AutoMapperBootStrapper.ConfigureAutoMapper(); IUnitOfWork uow = new NHUnitOfWork(); this._supplierProductRepository = new SupplierProductRepository(uow); this._supplierProductService = new SupplierProductService(this._supplierProductRepository, uow); this._usersRepository = new UsersRepository(uow); this._productRepository = new ProductRepository(uow); this._supplierRepository = new SupplierRepository(uow); this._supplierService = new SupplierService(this._supplierRepository, this._usersRepository, this._productRepository, uow); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { AutoMapperBootStrapper.ConfigureAutoMapper(); services.AddApplicationInsightsTelemetry(Configuration); //services.AddDbContext<LoteryContext>(options => options.UseSqlServer(Configuration.GetConnectionString("defaultConnection"))); services.AddScoped(typeof(IProductRepository), typeof(ProductRepository)); services.AddScoped(typeof(IProductService), typeof(ProductService)); //services.AddScoped<ContextDb>(s => new ContextDb(Configuration.GetConnectionString("defaultConnection"))); services.AddMvc(); }
public UsersServiceTest() { IUnitOfWork uow = new NHUnitOfWork(); IUsersRepository _usersRepository = new UsersRepository(uow); IRoleRepository _roleRepository = new RoleRepository(uow); IOrganizationRepository _organizationRepository = new OrganizationRepository(uow); IOrganizationService _organizationService = new OrganizationService(_organizationRepository, uow); this._usersIdGenerator = new IdGenerator <Users>(); this._userService = new UsersService(_usersRepository, _organizationService, null, this._usersIdGenerator, uow); this._organizationService = new OrganizationService(_organizationRepository, uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //Ioc的两种方式 DefaultControllerFactory||(DenpendencyResolver&&DenpendencyScope) ControllerBuilder.Current.SetControllerFactory(new UnityControllerFactory()); //GlobalConfiguration.Configuration.DependencyResolver = new UnityDependency(); AutoMapperBootStrapper.Start(); }
public static void Init() { Core.Initializer.Init <XyDbContext>(ConnectionString); var fromAssembly = typeof(IGblSettingService).Assembly; var toAssembly = typeof(GblSettingService).Assembly; IoC.RegisterType(fromAssembly, toAssembly, new Type[] { }); AutoMapperBootStrapper.Initialize(new Assembly[] { typeof(GblSettingService).Assembly }); IoC.RegisterType <ICommandWrapper, CommandWrapper>(); }
public static void Init(string connectionString, params Type[] excludeTypes) { Core.Initializer.Init <XyDbContext>(connectionString); var fromAssembly = typeof(IAdditionalMealService).Assembly; var toAssembly = typeof(Logistics.AdditionalMealService).Assembly; IoC.RegisterType(fromAssembly, toAssembly, excludeTypes); AutoMapperBootStrapper.Initialize(new Assembly[] { typeof(Logistics.AdditionalMealService).Assembly }); IoC.RegisterType <ICommandWrapper, CommandWrapper>(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); //配置调用WebApi借口 FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); BootStrapper.ConfigureDependencies(); AutoMapperBootStrapper.ConfigureAutoMapper(); ApplicationSettingsFactory.InitializeApplicationSettingsFactory(ObjectFactory.GetInstance <IApplicationSettings>()); ControllerBuilder.Current.SetControllerFactory(new WangYc.Controllers.IocControllerFactory()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); //Dependency Injection ControllerBuilder.Current.SetControllerFactory(new NinjectDependencyResolver()); //Service Automapper AutoMapperBootStrapper.ConfigureAutoMapper(); //DataBase Initializer Database.SetInitializer(new Initializer()); }
public ArrivalReceiptTest() { IUnitOfWork uow = new NHUnitOfWork(); this._arrivalReceiptRepository = new ArrivalReceiptRepository(uow); this._arrivalReceiptDetailRepository = new ArrivalReceiptDetailRepository(uow); this._arrivalReceiptService = new ArrivalReceiptService(this._arrivalReceiptRepository, this._arrivalReceiptDetailRepository, uow); this._workflowActivityService = new WorkflowActivityService(null, uow); this._arrivalNoticeRepository = new ArrivalNoticeRepository(uow); this._arrivalNoticeDetailRepository = new ArrivalNoticeDetailRepository(uow); this._arrivalNoticeService = new ArrivalNoticeService(this._arrivalNoticeRepository, this._arrivalNoticeDetailRepository, this._arrivalReceiptService, this._workflowActivityService, uow); AutoMapperBootStrapper.ConfigureAutoMapper(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <PharmixEntityContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <PharmixEntityContext>() .AddDefaultTokenProviders(); // Add application services. services.AddTransient <IEmailSender, EmailSender>(); services.AddTransient <IRepository, Repository>(); services.AddTransient <ICustomerService, CustomerService>(); services.AddTransient <IShiftService, ShiftService>(); services.AddTransient <ICacheService, CacheService>(); services.AddTransient <IAuditInfoService, AuditInfoService>(); services.AddTransient <IUserService, UserService>(); services.AddTransient <IModuleService, ModuleService>(); services.AddTransient <IRolePermissionService, RolePermissionService>(); services.AddTransient <ISiteService, SiteService>(); services.AddTransient <ITrustService, TrustService>(); services.AddTransient <IPermissionGroupService, PermissionGroupService>(); services.AddTransient <ILookupService, LookupService>(); services.AddTransient <IPatientService, PatientService>(); services.AddTransient <ISchedulerService, SchedulerService>(); services.AddTransient <ILoanService, LoanService>(); services.AddTransient <IDocumentService, DocumentService>(); services.AddTransient <IBankAccountService, BankAccountService>(); services.AddTransient <IViewRenderService, ViewRenderService>(); services.AddSession(opts => { opts.IdleTimeout = TimeSpan.FromMinutes(20); opts.Cookie.HttpOnly = true; }); services.AddMemoryCache(); services.AddMvc() .AddJsonOptions(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver());; AutoMapperBootStrapper.RegisterMappings(); services.AddSignalR(); }