Exemple #1
0
        public async Task HasDataGridAudits()
        {
            // Arrange
            var kernel = IntegrationSetupFixture.CreateNewKernel();

            kernel.Bind <IServicesMgr>().ToConstant(TestUtilities.GetKeplerServicesManager());
            kernel.Bind <IHelper>().ToConstant(TestUtilities.GetMockHelper().Object);

            var workspaceId       = Config.WorkSpaceId;
            var connectionFactory = TestUtilities.GetIntegrationConnectionFactory();
            var hourRepository    = new HourRepository(connectionFactory);
            var hour = await hourRepository.ReadLatestCompletedHourAsync();

            var dataGridCacheRepositoryMock = new Mock <IDataGridCacheRepository>();

            dataGridCacheRepositoryMock.Setup(m => m.ReadUseDataGrid(workspaceId, It.IsAny <int>())).ReturnsAsync(false);

            var factory =
                new WorkspaceAuditServiceFactory(
                    new RelativityApplicationRepository(connectionFactory),
                    kernel.Get <IWorkspaceAuditServiceProvider <ISqlWorkspaceAuditService> >(),
                    kernel.Get <IWorkspaceAuditServiceProvider <IDataGridWorkspaceAuditService> >(),
                    new PdbSqlToggleProvider(connectionFactory),
                    TestUtilities.GetMockLogger().Object,
                    dataGridCacheRepositoryMock.Object);

            // Act
            var result = await factory.HasDataGridAudits(workspaceId, hour.Id);

            // Assert
            Assert.That(result, Is.True);
        }
        public async Task CalculateSample()
        {
            var connectionFactory = TestUtilities.GetIntegrationConnectionFactory();
            var serverRepository  = new ServerRepository(connectionFactory);
            var servers           = await serverRepository.ReadAllActiveAsync();

            var server         = servers.First(s => s.ServerType == ServerType.Database);
            var hourRepository = new HourRepository(connectionFactory);
            var hour           = await hourRepository.ReadNextHourWithoutRatings() ?? await hourRepository.ReadLatestCompletedHourAsync();

            var result = await this.userExperienceSampleService.CalculateSample(server.ServerId, hour.Id);

            Assert.Pass();
        }