Пример #1
0
        public async Task AdminScriptsInstalled_True()
        {
            // Ensure environment state
            var serverRepo = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);
            var servers    = serverRepo.ReadAllActive();
            await servers.Select(s => serverRepo.DeleteAsync(s)).WhenAllStreamed(1);

            var result = this.sqlServerRepository.AdminScriptsInstalled();

            Assert.That(result, Is.True);             // This should be true if there are no servers listed in the db
        }
Пример #2
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);
        }
Пример #3
0
        public async Task Server_ZDeleteAsync()
        {
            //Arrange
            var repo = new ServerRepository(connectionFactory);

            //Act
            await repo.DeleteAsync(server);

            var result = await repo.ReadAsync(server.ServerId);

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.DeletedOn, Is.Not.Null);
        }
Пример #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);
        }
 public async Task OneTimeTearDown()
 {
     var serverRepository = new ServerRepository(ConnectionFactorySetup.ConnectionFactory);
     await serverRepository.DeleteAsync(this.server);
 }