-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling null and empty setting name parameter in DefaultNameResolver
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
test/Microsoft.Azure.WebJobs.Host.UnitTests/DefaultNameResolverTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using Microsoft.Extensions.Configuration; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.WebJobs.Host.UnitTests | ||
{ | ||
public class DefaultNameResolverTests | ||
{ | ||
[Fact] | ||
public void Resolve_WithNullOrEmptyNameParameter_ReturnsNull() | ||
{ | ||
var configuration = new ConfigurationBuilder().Build(); | ||
var resolver = new DefaultNameResolver(configuration); | ||
|
||
// Assert we null returns null | ||
string result = resolver.Resolve(null); | ||
Assert.Null(result); | ||
|
||
// Assert empty returns null | ||
result = resolver.Resolve(string.Empty); | ||
Assert.Null(result); | ||
} | ||
} | ||
} |