-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resetting root configuration on specialization
- Loading branch information
Showing
2 changed files
with
45 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
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,37 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.WebJobs.Script.WebHost; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Tests | ||
{ | ||
public class StandbyManagerTests | ||
{ | ||
[Fact] | ||
public async Task Specialize_ResetsConfiguration() | ||
{ | ||
var mockHostManager = new Mock<IScriptHostManager>(); | ||
mockHostManager.Setup(m => m.State) | ||
.Returns(ScriptHostState.Running); | ||
|
||
var mockConfiguration = new Mock<IConfigurationRoot>(); | ||
var mockOptionsMonitor = new Mock<IOptionsMonitor<ScriptApplicationHostOptions>>(); | ||
var mockLoggerFactory = new Mock<ILoggerFactory>(); | ||
|
||
var manager = new StandbyManager(mockHostManager.Object, mockConfiguration.Object, mockOptionsMonitor.Object, mockLoggerFactory.Object); | ||
|
||
await manager.SpecializeHostAsync(); | ||
|
||
mockConfiguration.Verify(c => c.Reload()); | ||
} | ||
} | ||
} |