Skip to content

Commit 71f1c45

Browse files
authored
Worker unit tests (#661)
* add workerunittest class * fix build warning * fix xml comment * update tests
1 parent 679244f commit 71f1c45

File tree

4 files changed

+900
-5
lines changed

4 files changed

+900
-5
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using Microsoft.Azure.Functions.Worker.Extensions.Sql;
5+
using Microsoft.Extensions.Hosting;
6+
using Xunit;
7+
using System;
8+
9+
namespace WorkerUnitTests
10+
{
11+
public class SqlInputBindingTests
12+
{
13+
[Fact]
14+
public void TestNullCommandText()
15+
{
16+
Assert.Throws<ArgumentNullException>(() => new SqlInputAttribute(null, "SqlConnectionString"));
17+
Assert.Throws<ArgumentNullException>(() => new SqlOutputAttribute(null, "SqlConnectionString"));
18+
19+
}
20+
21+
[Fact]
22+
public void TestNullConnectionStringSetting()
23+
{
24+
Assert.Throws<ArgumentNullException>(() => new SqlInputAttribute("SELECT * FROM dbo.Products", null));
25+
Assert.Throws<ArgumentNullException>(() => new SqlOutputAttribute("dbo.Products", null));
26+
27+
}
28+
29+
[Fact]
30+
public void TestNullBuilder()
31+
{
32+
HostBuilder builder = null;
33+
Assert.Throws<NullReferenceException>(() => builder.ConfigureFunctionsWorkerDefaults());
34+
}
35+
36+
}
37+
}

0 commit comments

Comments
 (0)