Пример #1
0
        public async Task Setup()
        {
            connectionFactory = TestUtilities.GetIntegrationConnectionFactory();
            var repo = new ServerRepository(connectionFactory);

            server = await repo.CreateAsync(new Server
            {
                ServerName                       = Environment.MachineName,
                CreatedOn                        = DateTime.Now,
                DeletedOn                        = null,
                ServerTypeId                     = 3,
                ServerIpAddress                  = "127.0.0.1",
                IgnoreServer                     = false,
                ResponsibleAgent                 = "",
                ArtifactId                       = 1234,
                LastChecked                      = null,
                UptimeMonitoringResourceHost     = null,
                UptimeMonitoringResourceUseHttps = null,
                LastServerBackup                 = null,
                AdminScriptsVersion              = null,
            });

            server.UptimeMonitoringResourceHost = UpdatedHost;
            await repo.UpdateAsync(server);
        }
        public async Task OneTimeSetup()
        {
            var hourRepo = new HourRepository(ConnectionFactorySetup.ConnectionFactory);

            this.metricRepository = new MetricRepository(ConnectionFactorySetup.ConnectionFactory);
            var serverRepository = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);

            this.server = await serverRepository.CreateAsync(new Server
            {
                ServerName       = Environment.MachineName,
                CreatedOn        = DateTime.Now,
                DeletedOn        = null,
                ServerTypeId     = 3,
                ServerIpAddress  = "127.0.0.1",
                IgnoreServer     = false,
                ResponsibleAgent = "",
                ArtifactId       = 1234,
            });

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

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

            this.metricDataRepository = new MetricDataRepository(ConnectionFactorySetup.ConnectionFactory);
            metricData = await this.metricDataRepository.CreateAsync(new MetricData { MetricId = metric.Id, Score = 100.0m });

            metricData.Score = 75.0m;
            metricData.Data  = "asdf";
            await this.metricDataRepository.UpdateAsync(metricData);

            metricData = await this.metricDataRepository.ReadAsync(metricData.Id);
        }
Пример #3
0
        public async Task AdminScriptsInstalled_False()
        {
            // Ensure environment state
            var serverRepo = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);
            var testServer = await serverRepo.CreateAsync(new Server { CreatedOn = DateTime.UtcNow, ServerType = ServerType.Database });

            var result = this.sqlServerRepository.AdminScriptsInstalled();

            Assert.That(result, Is.False);

            // Teardown
            await serverRepo.DeleteAsync(testServer);
        }
Пример #4
0
        public async Task ClearUnresolvedGapReportData()
        {
            // Arrange
            // Create test server
            var serverRepository = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);
            var testServer       = new Server
            {
                ServerName = "TestServer",
                CreatedOn  = DateTime.UtcNow,
                ServerType = ServerType.Database
            };
            var server = await serverRepository.CreateAsync(testServer);

            // Create test database
            var databaseRepository = new DatabaseRepository(ConnectionFactorySetup.ConnectionFactory);
            var testDatabase       = new Database
            {
                Type        = DatabaseType.Workspace,
                Name        = "TestDatabase",
                WorkspaceId = 1,
                ServerId    = server.ServerId
            };
            var database = await databaseRepository.CreateAsync(testDatabase);

            // Create test gap report (unresolved)
            var entry = new GapReportEntry
            {
                DatabaseId   = database.Id,
                ActivityType = (int)GapActivityType.Backup,
                LastActivity = new DateTime(1901, 1, 2, 3, 4, 5),
                GapSize      = 10002000
            };

            await this.reportRepository.CreateGapReportData(entry);

            // Act - Clear test gap report
            await this.reportRepository.ClearUnresolvedGapReportData(server.ServerId, GapActivityType.Backup);

            // Assert
            Assert.Pass("No results returned");

            // Tear down
            await serverRepository.DeleteAsync(server);
        }
Пример #5
0
        public async Task OneTimeSetup()
        {
            var serverRepo = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);

            this.server = await serverRepo.CreateAsync(new Server
            {
                ServerName       = Environment.MachineName,
                CreatedOn        = DateTime.Now,
                DeletedOn        = null,
                ServerTypeId     = 3,
                ServerIpAddress  = "127.0.0.1",
                IgnoreServer     = false,
                ResponsibleAgent = "",
                ArtifactId       = 1234,
            });

            this.databaseRepository     = new DatabaseRepository(ConnectionFactorySetup.ConnectionFactory);
            this.databaseGapsRepository = new DatabaseGapsRepository(ConnectionFactorySetup.ConnectionFactory);
        }