public ImportIntoS3Tasks()
        {
            appHost = new BasicAppHost().Init();

            var s3Client = new AmazonS3Client(AwsConfig.AwsAccessKey, AwsConfig.AwsSecretKey, RegionEndpoint.USEast1);
            s3 = new S3VirtualPathProvider(s3Client, AwsConfig.S3BucketName, appHost);
        }
        public void TestFixtureSetUp()
        {
            _listeningOn = "http://localhost:1234/api/";

            appHost = new TestAppHost
            {
                ConfigureContainer = container =>
                {
                    var dbFactory = new OrmLiteConnectionFactory(
                        "Data Source=mydb.db;Version=3;", SqliteDialect.Provider);
                    container.Register<IDbConnectionFactory>(dbFactory);
                    container.RegisterAutoWiredAs
                        <PlacesToVisitRepository, IPlacesToVisitRepository>();
                    container.Register(new PlacesToVisitAppSettings());
                    var repo = container.Resolve<IPlacesToVisitRepository>();
                    repo.InitializeSchema();
                    _seedData.CreateUsers(container);
                    _seedData.SeedPlaces(repo);

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

            }.Init().Start(_listeningOn);
        }
Esempio n. 3
0
        public UnitTests()
        {
            appHost = new BasicAppHost(typeof(ListOfPluginsService).Assembly)
            {

            }
            .Init();
            appHost.Container.Register<IData>(x => new Data()).ReusedWithin(ReuseScope.Container);
        }
Esempio n. 4
0
 public EchoTests()
 {
     _appHost = new BasicAppHost(typeof(EchoService).Assembly)
     {
         ConfigureContainer = container =>
         {
         }
     }
     .Init();
 }
        public LimitKeyGeneratorTests()
        {
            if (ServiceStackHost.Instance == null)
            {
                appHost = new BasicAppHost { TestMode = true }.Init();

                // The GetConsumerId method requires an AuthUserSession.
                AuthenticateService.Init(() => new AuthUserSession(), new BasicAuthProvider(appHost.AppSettings));
            }
        }
Esempio n. 6
0
        public static void BindHost(ServiceStackHost appHost, IApplicationBuilder app)
        {
            var logFactory = app.ApplicationServices.GetService<ILoggerFactory>();
            if (logFactory != null)
            {
                LogManager.LogFactory = new NetCoreLogFactory(logFactory);
            }

            appHost.Container.Adapter = new NetCoreContainerAdapter(app.ApplicationServices);
        }
Esempio n. 7
0
 public WorkspaceTests()
 {
     _appHost = new BasicAppHost(typeof(WorkspaceService).Assembly)
     {
         ConfigureContainer = container =>
         {
         }
     }
     .Init();
 }
Esempio n. 8
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(ServiceInterface.SimpleDb.Domain.SimpleDbDomainService).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
         }
     }
     .Init();
 }
Esempio n. 9
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(MyServices).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
         }
     }
     .Init();
 }
        public ConcurrentRequestsTest()
        {
            var containerBuilder = new ContainerBuilder();
            containerBuilder.RegisterType<ValueHolder>().AsSelf().InstancePerRequest();

            var container = containerBuilder.Build();

            _appHost = new AppHost()
                .UseAutofac(container)
                .Init()
                .Start($"http://*:{ServicePort}/");
        }
Esempio n. 11
0
 public void TestFixtureSetUp()
 {
     appHost = new BasicAppHost(typeof(SkyBillService).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
             container.Register<IBillBL>(c => new BillStub { });
         }
     }
     .Init();
 }
Esempio n. 12
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(ServerEventsServices).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
             container.RegisterAutoWiredAs<MemoryChatHistory, IChatHistory>();
         }
     }
     .Init();
 }
Esempio n. 13
0
        public AdminTasks()
        {
            appHost = new BasicAppHost(typeof(MyServices).Assembly)
            {
                ConfigureContainer = container =>
                {
                    //Add your IoC dependencies here
                    container.Register<IDbConnectionFactory>(new OrmLiteConnectionFactory("~/App_Data/db.sqlite".MapHostAbsolutePath(),SqliteDialect.Provider));

                }
            }
            .Init();
        }
Esempio n. 14
0
        public UnitTests()
        {
            appHost = new BasicAppHost(typeof(EmailServices).Assembly)
            {
                ConfigureContainer = container =>
                {
                    container.Register<IDbConnectionFactory>(c =>
                        new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider));

                    container.RegisterAs<DbEmailer, IEmailer>();

                    using (var db = container.TryResolve<IDbConnectionFactory>().Open())
                    {
                        db.DropAndCreateTable<Contact>();
                        db.DropAndCreateTable<Email>();

                        db.Insert(new Contact { Name = "Test Contact", Email = "*****@*****.**", Age = 10 });
                    }
                }
            }
            .Init();
        }
Esempio n. 15
0
 public AdminTasks()
 {
     appHost = new BasicAppHost().Init();
     s3 = AwsConfig.CreateS3VirtualPathProvider(appHost, AwsConfig.S3BucketName);
 }
Esempio n. 16
0
 public UnitTests()
 {
     appHost = new AppHost();
     appHost.Init().Start("http://*:2337/");
 }
 public void TestFixtureSetUp()
 {
     _appHost = new BasicAppHost
     {
         ConfigureContainer = c =>
         {
             var authService = new AuthenticateService();
             c.Register(authService);
             c.Register<IAuthSession>(AuthUserSession);
             AuthenticateService.Init(() => AuthUserSession, new CredentialsAuthProvider());
         }
     }.Init();
 }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // free managed resources
         if (AppHost != null)
         {
             AppHost.Dispose();
             AppHost = null;
         }
     }
     // Free native resources
     // <None>
 }
Esempio n. 19
0
        public UnitTests()
        {
            appHost = new BasicAppHost(typeof(MyServices).Assembly)
            {
                ConfigureContainer = container =>
                {
                    //Add your IoC dependencies here
                    container.Register<IDbConnectionFactory>(
                        new OrmLiteConnectionFactory(
                            "~/../../../StackApis/App_Data/db.sqlite".MapServerPath(),
                            SqliteDialect.Provider));

                    using (var db = container.Resolve<IDbConnectionFactory>().OpenDbConnection())
                    {
                        db.DropAndCreateTable<Question>();
                        db.DropAndCreateTable<Answer>();
                        db.DropAndCreateTable<QuestionTag>();
                    }

                    SeedStackOverflowData(container.Resolve<IDbConnectionFactory>());
                }
            }
            .Init();
        }
Esempio n. 20
0
 public void TestFixtureSetUp()
 {
     appHost = new AppHost()
         .Init()
         .Start("http://*:2020/");
 }