mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-30 09:35:38 -05:00
Fix CancelMultipleBackup test failure (#399)
* Fix cancelMultipleBackup test failure Please enter the commit message for your changes. Lines starting * Add semaphore to backup stub operation * remove spaces
This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
||||
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery;
|
||||
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Threading;
|
||||
|
||||
@@ -17,6 +18,14 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DisasterRecovery
|
||||
/// </summary>
|
||||
public class BackupOperationStub : IBackupOperation
|
||||
{
|
||||
public SemaphoreSlim BackupSemaphore { get; set; }
|
||||
|
||||
public BackupOperationStub()
|
||||
{
|
||||
this.BackupSemaphore = new SemaphoreSlim(0, 1);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialize
|
||||
/// </summary>
|
||||
@@ -49,7 +58,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.DisasterRecovery
|
||||
/// </summary>
|
||||
public void PerformBackup()
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
this.BackupSemaphore.Wait(TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user