public GivenAnAssignmentClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            var projectContext = ProjectContextFactory.Build(projectContextOptions);

            _projectClient  = new ProjectClient(projectContext, clientOptions);
            _taskClient     = new TaskClient(projectContext, clientOptions);
            _resourceClient = new EnterpriseResourceClient(projectContext, clientOptions);

            _client = new AssignmentClient(projectContext, clientOptions);

            _publishedProject = CreateTestProject().Result;
            _publishedTask    = CreateTestTask().Result;

            _enterpriseResource  = CreateTestResource().Result;
            _enterpriseResource2 = CreateTestResource().Result;

            _publishedProject = _projectClient.LinkToEnterpriseResources(_publishedProject, new [] { _enterpriseResource, _enterpriseResource2 }).Result;
        }
        public GivenAProjectClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            _projectContext           = ProjectContextFactory.Build(projectContextOptions);
            _client                   = new ProjectClient(_projectContext, clientOptions);
            _enterpriseResourceClient = new EnterpriseResourceClient(_projectContext, clientOptions);
        }
Esempio n. 3
0
        public ServiceFixture()
        {
            var configuration = ConfigurationRootFactory.Create();
            var services      = new ServiceCollection();

            services.AddModules(configuration);

            Db = DbTestClientFactory.Create <DatabaseContext>(ConfigurationKeys.DatabaseConnectionKey, e => new DatabaseContext(e));

            ServiceProvider = services.BuildServiceProvider();

            MyFoos = GetService <IMyFooService>();
        }
Esempio n. 4
0
        public static DbTestClient <TDbContext> Create <TDbContext>(string connectionStringKey, Func <DbContextOptions <TDbContext>, TDbContext> createDbContext, Action <SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)
            where TDbContext : DbContext
        {
            var configurationRoot = ConfigurationRootFactory.Create();

            var connectionString       = configurationRoot.GetConnectionString(connectionStringKey);
            var databaseContextFactory = new SqlServerDbContextFactory <TDbContext>(connectionString, createDbContext, sqlServerOptionsAction);
            var databaseTestClient     = new DbTestClient <TDbContext>(databaseContextFactory);

            databaseTestClient.EnsureDatabaseCreated(); // TODO: VC: Check this applies all migrations

            return(databaseTestClient);
        }
        public GivenACustomFieldClientInstance()
        {
            IApplicationContext  applicationContext  = new ApplicationContext();
            IConfigurationRoot   configurationRoot   = ConfigurationRootFactory.Create(applicationContext);
            IConfigurationGetter configurationGetter = new ConfigurationGetter(configurationRoot);

            var projectContextOptions = configurationGetter.GetOptions <ProjectContextOptions>();
            var clientOptions         = configurationGetter.GetOptions <CsomClientOptions>();

            var projectContext = ProjectContextFactory.Build(projectContextOptions);

            _client           = new CustomFieldClient(projectContext, clientOptions);
            _entityTypeClient = new EntityTypeClient(projectContext, clientOptions);
        }
Esempio n. 6
0
        public ServiceFixture()
        {
            var configuration = ConfigurationRootFactory.Create();
            var services      = new ServiceCollection();

            services.AddModules(configuration);

            Db = DbTestClientFactory.Create <DatabaseContext>(ConfigurationKeys.DatabaseConnectionKey, e => new DatabaseContext(e), ConfigurationKeys.SqlServerOptionsAction);

            ServiceProvider = services.BuildServiceProvider();

            Customers = GetService <ICustomerService>();
            Orders    = GetService <IOrderService>();
            Products  = GetService <IProductService>();
        }
Esempio n. 7
0
        public static WebTestClient Create <TStartup>() where TStartup : class
        {
            var configurationRoot = ConfigurationRootFactory.Create();

            return(Create <TStartup>(configurationRoot));
        }