mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Adding missing nuget references for SqlProjects functionality (#1827)
* Adding test messages * Adding file system globbing reference * fixing string * fixing string again * Sigh
This commit is contained in:
@@ -7,7 +7,9 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking
|
||||
{
|
||||
@@ -61,7 +63,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking
|
||||
}
|
||||
}
|
||||
|
||||
public class MockRequest<T>
|
||||
public class MockRequest<T> where T : ResultStatus
|
||||
{
|
||||
private T? result;
|
||||
public T Result => result ?? throw new InvalidOperationException("No result has been sent for the request");
|
||||
@@ -73,5 +75,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common.RequestContextMocking
|
||||
{
|
||||
Mock = RequestContextMocks.Create<T>(actual => result = actual);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts that this request was successful
|
||||
/// </summary>
|
||||
/// <param name="handlerName">Name of the handler, recommended to use nameof(service.MyHandler), used in the failure message</param>
|
||||
/// <param name="descriptor">Optional extra descriptor, parenthesized in the failure message</param>
|
||||
public void AssertSuccess(string handlerName, string? descriptor = null)
|
||||
{
|
||||
Assert.IsTrue(this.Result.Success, $"{handlerName}{(descriptor != null ? $" ({descriptor})" : String.Empty)} expected to succeed, but failed with error: '{this.Result.ErrorMessage}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user