public async Task GetLastBackupsBeforeHourAsync() { // Arrange var hourTimeStamp = DateTime.UtcNow.NormilizeToHour(); var backupEnd = DateTime.UtcNow.NormilizeToHour().AddMinutes(-30); var serverName = "TestServerName"; var databaseName = "TestDatabaseName"; var backupType = BackupType.Full; var testBackup = new MockBackupSet { Server = serverName, Database = databaseName, BackupStartDate = backupEnd.AddMinutes(-5), BackupEndDate = backupEnd, BackupType = ((char)backupType).ToString() }; await this.backupTestDataRepository.CreateAsync(new List <MockBackupSet> { testBackup }); var hour = new Hour { HourTimeStamp = hourTimeStamp }; var server = new Server { ServerName = serverName }; var database = new Database { Name = databaseName }; var databases = new List <Database> { database }; var backupTypes = new List <BackupType> { backupType }; var results = await this.backupProvider.GetLastBackupsBeforeHourAsync(hour, server, databases, backupTypes); // Assert Assert.That(results.Count, Is.EqualTo(1)); var result = results.First(); Assert.That(result.DatabaseName, Is.EqualTo(testBackup.Database)); Assert.That(result.Start, Is.EqualTo(testBackup.BackupStartDate)); Assert.That(result.End, Is.EqualTo(testBackup.BackupEndDate)); Assert.That(result.BackupType.ToString(), Is.EqualTo(testBackup.BackupType)); }
public async Task CreateAsync() { var testData = new MockBackupSet { Server = "ServerNameTest", Database = "DatabaseNameTest", BackupStartDate = DateTime.UtcNow.NormilizeToHour(), BackupEndDate = DateTime.UtcNow.NormilizeToHour().AddSeconds(3), BackupType = "D" }; var testDataList = new List <MockBackupSet> { testData }; await this.backupTestDataRepository.CreateAsync(testDataList); Assert.Pass("No return results"); }