mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-04 09:35:37 -05:00
Integrate generate script with task service (#426)
* Support generate script for backup * change * update task service data contract for Generate Script * more changes * update test * add comments * Add missing files * update stub backup operation for testing * pr comments * remove empty space * Fix tests * Add unit/integration tests and isCancelable to TaskInfo * address pr comments * pr comments - fix tests * fix minor issue * fix minor issues * remove unused variable
This commit is contained in:
@@ -86,5 +86,40 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.TaskServices
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task VerifyScriptTask()
|
||||
{
|
||||
using (SqlTaskManager manager = new SqlTaskManager())
|
||||
{
|
||||
DatabaseOperationStub operation = new DatabaseOperationStub();
|
||||
operation.TaskResult = new TaskResult
|
||||
{
|
||||
TaskStatus = SqlTaskStatus.Succeeded
|
||||
};
|
||||
SqlTask sqlTask = manager.CreateTask(taskMetaData, operation.FunctionToScript);
|
||||
|
||||
bool scriptAddedEventRaised = false;
|
||||
string script = null;
|
||||
sqlTask.ScriptAdded += (object sender, TaskEventArgs<TaskScript> e) =>
|
||||
{
|
||||
scriptAddedEventRaised = true;
|
||||
script = e.TaskData.Script;
|
||||
};
|
||||
|
||||
Assert.NotNull(sqlTask);
|
||||
|
||||
Task taskToVerify = sqlTask.RunAsync().ContinueWith(task =>
|
||||
{
|
||||
Assert.True(scriptAddedEventRaised);
|
||||
Assert.True(!string.IsNullOrEmpty(script));
|
||||
Assert.True(manager.HasCompletedTasks());
|
||||
manager.RemoveCompletedTask(sqlTask);
|
||||
});
|
||||
operation.Stop();
|
||||
await taskToVerify;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user