// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // #nullable disable using Microsoft.SqlTools.ServiceLayer.DisasterRecovery; using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts; using Microsoft.SqlTools.ServiceLayer.Management; using Microsoft.SqlTools.ServiceLayer.TaskServices; using System; using Microsoft.Data.SqlClient; using System.Threading; namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DisasterRecovery { /// /// Stub class that implements IBackupOperation /// public class BackupOperationStub : IBackupOperation { public SemaphoreSlim BackupSemaphore { get; set; } public BackupOperationStub() { this.BackupSemaphore = new SemaphoreSlim(0, 1); } public string ScriptContent { get; set; } public string ErrorMessage { get { return string.Empty; } } public SqlTask SqlTask { get; set; } /// /// Initialize /// /// /// public void Initialize(CDataContainer dataContainer, SqlConnection sqlConnection) { } /// /// Return database metadata for backup /// /// /// public BackupConfigInfo CreateBackupConfigInfo(string databaseName) { return null; } /// /// Set backup input properties /// /// public void SetBackupInput(BackupInfo input) { } /// /// Execute backup /// public void Execute(TaskExecutionMode mode) { this.BackupSemaphore.Wait(TimeSpan.FromSeconds(5)); } /// /// Cancel backup /// public void Cancel() { } } }