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);
        }
예제 #3
0
        public UnitTests()
        {
            appHost = new BasicAppHost(typeof(ListOfPluginsService).Assembly)
            {

            }
            .Init();
            appHost.Container.Register<IData>(x => new Data()).ReusedWithin(ReuseScope.Container);
        }
예제 #4
0
파일: EchoTests.cs 프로젝트: feliara8/Test
 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));
            }
        }
예제 #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);
        }
예제 #7
0
 public WorkspaceTests()
 {
     _appHost = new BasicAppHost(typeof(WorkspaceService).Assembly)
     {
         ConfigureContainer = container =>
         {
         }
     }
     .Init();
 }
예제 #8
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(ServiceInterface.SimpleDb.Domain.SimpleDbDomainService).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
         }
     }
     .Init();
 }
예제 #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}/");
        }
예제 #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();
 }
예제 #12
0
 public UnitTests()
 {
     appHost = new BasicAppHost(typeof(ServerEventsServices).Assembly)
     {
         ConfigureContainer = container =>
         {
             //Add your IoC dependencies here
             container.RegisterAutoWiredAs<MemoryChatHistory, IChatHistory>();
         }
     }
     .Init();
 }
예제 #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();
        }
예제 #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();
        }
예제 #15
0
 public AdminTasks()
 {
     appHost = new BasicAppHost().Init();
     s3 = AwsConfig.CreateS3VirtualPathProvider(appHost, AwsConfig.S3BucketName);
 }
예제 #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>
 }
예제 #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();
        }
예제 #20
0
 public void TestFixtureSetUp()
 {
     appHost = new AppHost()
         .Init()
         .Start("http://*:2020/");
 }