mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-31 09:35:39 -05:00
Add error for sql bindings when .net 5 (#1259)
* add error for sql bindings when .net 5 * add test * cleanup linq stuff and move out common code
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Microsoft.Azure.Functions.Worker;
|
||||
using Microsoft.Azure.Functions.Worker.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Company.Function
|
||||
{
|
||||
public static class HttpTrigger1
|
||||
{
|
||||
[Function("HttpTrigger1")]
|
||||
public static HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req,
|
||||
FunctionContext executionContext)
|
||||
{
|
||||
var logger = executionContext.GetLogger("HttpTrigger1");
|
||||
logger.LogInformation("C# HTTP trigger function processed a request.");
|
||||
|
||||
var response = req.CreateResponse(HttpStatusCode.OK);
|
||||
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
|
||||
|
||||
response.WriteString("Welcome to Azure Functions!");
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,6 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AzureFunctions
|
||||
string testFile = Path.Join(Path.GetTempPath(), $"NoAzureFunctions-{DateTime.Now.ToString("yyyy - dd - MM--HH - mm - ss")}.cs");
|
||||
FileStream fstream = File.Create(testFile);
|
||||
fstream.Close();
|
||||
|
||||
GetAzureFunctionsParams parameters = new GetAzureFunctionsParams
|
||||
{
|
||||
filePath = testFile
|
||||
@@ -178,5 +177,24 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.AzureFunctions
|
||||
Assert.Null(result.ErrorMessage);
|
||||
Assert.AreEqual(0, result.azureFunctions.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify there are no errors when a file doesn't have any Azure functions
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void GetAzureFunctionsNet5()
|
||||
{
|
||||
string testFile = Path.Join(testAzureFunctionsFolder, "AzureFunctionsNet5.cs");
|
||||
|
||||
GetAzureFunctionsParams parameters = new GetAzureFunctionsParams
|
||||
{
|
||||
filePath = testFile
|
||||
};
|
||||
|
||||
GetAzureFunctionsOperation operation = new GetAzureFunctionsOperation(parameters);
|
||||
|
||||
Exception ex = Assert.Throws<Exception>(() => { operation.GetAzureFunctions(); });
|
||||
Assert.AreEqual(SR.SqlBindingsNet5NotSupported, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<Compile Remove="AzureFunctions\AzureFunctionTestFiles\AzureFunctionsMultipleSameFunction.cs" />
|
||||
<Compile Remove="AzureFunctions\AzureFunctionTestFiles\AzureFunctionsNoBindings.cs" />
|
||||
<Compile Remove="AzureFunctions\AzureFunctionTestFiles\AzureFunctionsOutputBinding.cs" />
|
||||
<Compile Remove="AzureFunctions\AzureFunctionTestFiles\AzureFunctionsNet5.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="DacFx\Dacpacs\" />
|
||||
|
||||
Reference in New Issue
Block a user