Пример #1
0
        public void ConfigureAppHost()
        {
            IConfiguration configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", true, true).Build();

            Licensing.RegisterLicense(configuration["ServiceStack:Licence"]);

            AppHost = new BasicAppHost(typeof(OrganizationService).Assembly)
            {
                TestMode           = true,
                ConfigureContainer = container =>
                {
                    container.RegisterAutoWiredAs <StubMessageBus, IMessageBus>();
                    container.RegisterAutoWiredAs <StubTimeProvider, ITimeProvider>();
                    container.Register <IAuthSession>(c => new AuthUserSession
                    {
                        Email = "*****@*****.**"
                    });
                    container.RegisterValidators(typeof(AddressValidator).Assembly);
                }
            };
            AppHost.Plugins.Add(new ValidationFeature());
            AppHost.Init();
            Service         = AppHost.Container.Resolve <T>();
            Service.Request = new MockHttpRequest();
        }
            public void InitializeContext()
            {
                appHost = new BasicAppHost();
                appHost.Init();

                container = appHost.Container;
            }
Пример #3
0
        public void Init()
        {
            appHost = new UnitTestHost();
            var debugSettings = new FileInfo(@"~/../../../TechStacks/wwwroot_build/deploy/appsettings.license.txt".MapAbsolutePath());

            Licensing.RegisterLicenseFromFileIfExists(debugSettings.FullName);
            appHost.Init();
        }
Пример #4
0
 public void TestFixtureSetUp()
 {
     appHost = new AppHost();
     Configure(appHost);
     appHost
     .Init()
     .Start(Config.ListeningOn);
 }
Пример #5
0
        void IAssemblyContext.OnAssemblyStart()
        {
            _port = 16000;
            var listeningOn = "http://localhost:" + _port + "/";

            _appHost = new ServiceStackHost();
            _appHost.Init();
            _appHost.Start(listeningOn);
        }
Пример #6
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(SyncAccountServices).Assembly)
     {
         ConfigureContainer = ConfigureAppHost
     };
     SeedAppSettings(appHost);
     appHost.Init();
 }
Пример #7
0
        public void OneTimeSetUp()
        {
            _port = 16000;
            var listeningOn = String.Format("http://localhost:{0}/", _port);

            _appHost = new ServiceStackHost();
            _appHost.Init();
            _appHost.Start(listeningOn);
        }
Пример #8
0
        public InProcessServiceGatewayRequestResponseFiltersTests()
        {
            _appHost = new InProcessAppHost();
            _appHost.GlobalRequestFilters.Add((req, resp, dto) => _filterCallLog.Add(req.PathInfo));
            _appHost.GlobalResponseFilters.Add((req, resp, dto) => _filterCallLog.Add(dto.GetType().Name));

            _appHost.Init()
            .Start(Config.ListeningOn);
            _client = new JsonServiceClient(Config.ListeningOn);
        }
Пример #9
0
 public ServiceCallTests()
 {
     JarsCore.Container = MEFBusinessLoader.Init();
     appHost            = new BasicAppHost()
     {
         ConfigureAppHost = cfg => { JsConfig.MaxDepth = 2; }
     };
     appHost.Init();
     //appHost.Container.AddTransient<QLJobService>();
     appHost.Container.AddTransient <ResourceGroupService>();
     appHost.Container.AddTransient <ResourceService>();
 }
        protected virtual void OneTimeSetUp()
        {
            AppHost = new TestAppHost();
            foreach (var appSetting in CustomAppSettings)
            {
                AppHost.AppSettings.Set(appSetting.Key, appSetting.Value);
            }

            AppHost.Init();
            AppHost.Start(BaseUri);

            ServiceInterface.Helper.ConfigureMappers();

            ServiceClient = new JsonServiceClient(BaseUri);
        }
Пример #11
0
        public ValidationRulesTests()
        {
            ValidationExtensions.RegisteredDtoValidators.Clear();

            appHost = new AppHost();
            var container = appHost.Container;
            var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);

            container.Register <IDbConnectionFactory>(dbFactory);
            container.Register(appHost.GetMemoryCacheClient());
            ((AppHost)appHost).ValidationFeature = GetValidationFeature(container);

            appHost.Init()
            .Start(Config.ListeningOn);
        }
        public void TestFixtureSetUp()
        {
            appHost = new AppHost();
            var dirPath = ClearFolders();

            Directory.CreateDirectory(dirPath.AppendPath("mount1", "dir1"));
            File.WriteAllText(dirPath.AppendPath("mount1", "file.txt"), "MOUNT1");
            File.WriteAllText(dirPath.AppendPath("mount1", "dir1", "nested-file.txt"), "NESTED MOUNT1");

            Directory.CreateDirectory(dirPath.AppendPath("mount2", "dir2"));
            File.WriteAllText(dirPath.AppendPath("mount2", "file.txt"), "MOUNT2");
            File.WriteAllText(dirPath.AppendPath("mount2", "dir2", "nested-file.txt"), "NESTED MOUNT2");

            appHost
            .Init()
            .Start(Config.ListeningOn);
        }
Пример #13
0
        public VirtualFileSystemMappingTestsBase()
        {
            appHost = CreateAppHost();
            var dirPath = ClearFolders();

            Directory.CreateDirectory(dirPath.AppendPath("mount1", "dir1"));
            File.WriteAllText(dirPath.AppendPath("mount1", "file.txt"), "MOUNT1");
            File.WriteAllText(dirPath.AppendPath("mount1", "dir1", "nested-file.txt"), "NESTED MOUNT1");

            Directory.CreateDirectory(dirPath.AppendPath("mount2", "dir2"));
            File.WriteAllText(dirPath.AppendPath("mount2", "file.txt"), "MOUNT2");
            File.WriteAllText(dirPath.AppendPath("mount2", "dir2", "nested-file.txt"), "NESTED MOUNT2");

            appHost
            .Init()
            .Start(Config.ListeningOn);
        }
Пример #14
0
        public void BaseSetUp()
        {
            AppHost = new BasicAppHost(typeof(FileService).Assembly)
            {
                ConfigureAppHost = host =>
                {
                    OrmLiteConfig.ExecFilter = new LogExecFilter();

                    host.Plugins.Add(new AuthFeature(() => new AuthUserSession(),
                                                     new IAuthProvider[]
                    {
                        new CredentialsAuthProvider()
                    }));

                    host.AppSettings = new EnvironmentVariableSettings();
                },
                ConfigureContainer = container =>
                {
                    var dbFactory = new OrmLiteConnectionFactory(DataSeed.TestDbConnection, MySqlDialect.Provider);

                    container.Register <IDbConnectionFactory>(c => dbFactory);
                    container.Register <ICacheClient>(new MemoryCacheClient());
                    container.Register <IAuthRepository>(c =>
                                                         new OrmLiteAuthRepository <UserInfo, UserAuthDetails>(dbFactory)
                    {
                        UseDistinctRoleTables = true
                    });

                    container.RegisterAs <OrgManage, IOrgManage>();
                    container.Register <ISchemaManage>(c => new MysqlSchemaManage("MyApp_test_db"));
                }
            };

            AppHost.Init();

            OrgManage = AppHost.Resolve <IOrgManage>();
            Db        = AppHost.GetDbConnection();

            DataSeed.InitDataTable(AppHost);
            DataSeed.Create(AppHost);
        }
Пример #15
0
 public void OnTestFixtureSetUp()
 {
     appHost = new AuthDigestAppHost(WebHostUrl, Configure);
     appHost.Init();
     appHost.Start(ListeningOn);
 }
 public void OnTestFixtureSetUp()
 {
     appHost = new AuthDigestAppHost(WebHostUrl, Configure);
     appHost.Init();
     appHost.Start(ListeningOn);
 }
Пример #17
0
 public UnitTests()
 {
     appHost = new AppHost();
     appHost.Init().Start("http://*:2337/");
 }
 public void TestFixtureSetUp()
 {
     appHost = new TestAppHost();
     appHost.Init();
     appHost.Start(Constants.ListeningOn);
 }
 public void InitializeAllTests()
 {
     appHost = new BasicAppHost();
     appHost.Init();
 }
Пример #20
0
 public void TestFixtureSetUp()
 {
     AppHost = new SharedDtoAppHost();
     AppHost.Init();
     AppHost.Start(Config.ListeningOn);
 }