コード例 #1
0
        public async Task SetUp()
        {
            connectionFactory = TestUtilities.GetIntegrationConnectionFactory();

            var hourRepo   = new HourRepository(connectionFactory);
            var metricRepo = new MetricRepository(connectionFactory);
            var hour       = await hourRepo.CreateAsync(new Hour { HourTimeStamp = DateTime.Now });

            var metric = await metricRepo.CreateAsync(new Metric { HourId = hour.Id, MetricType = MetricType.WebUptime });

            var metricDataRepo = new MetricDataRepository(connectionFactory);

            metricData = await metricDataRepo.CreateAsync(new MetricData { MetricId = metric.Id, Score = 100.0m });

            var repo = new AuditAnalysisRepository(connectionFactory);
            await repo.CreateAsync(Enumerable.Range(0, 4).Select(i =>
                                                                 new AuditAnalysis
            {
                MetricDataId = metricData.Id,
                TotalQueries = 123,
                TotalLongRunningQueries = 234,
                TotalComplexQueries = 345,
                UserId = 456
            }).ToList());

            auditAnalyses = await repo.ReadByMetricData(metricData);
        }
コード例 #2
0
        public async Task OneTimeSetup()
        {
            var hourRepo = new HourRepository(ConnectionFactorySetup.ConnectionFactory);

            hour = await hourRepo.CreateAsync(new Hour { HourTimeStamp = DateTime.Now });

            metricRepository = new MetricRepository(ConnectionFactorySetup.ConnectionFactory);
            metric           = await metricRepository.CreateAsync(new Metric { HourId = hour.Id, MetricType = MetricType.AgentUptime });

            metric = await metricRepository.ReadAsync(metric.Id);

            metric.MetricType = MetricType.WebUptime;
            await metricRepository.UpdateAsync(metric);
        }