Skip to content

Commit 8076201

Browse files
committed
Fixed tests
1 parent 39abc52 commit 8076201

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

github-monitor/Ahk.GitHub.Monitor.Tests/IntegrationTests/Helpers/FunctionBuilder.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
using System.Collections.Generic;
12
using Ahk.GitHub.Monitor.Config;
23
using Ahk.GitHub.Monitor.Services.EventDispatch;
4+
using Microsoft.Extensions.Configuration;
35
using Microsoft.Extensions.Logging;
46
using Microsoft.Extensions.Options;
57
using Moq;
@@ -13,6 +15,21 @@ internal static class FunctionBuilder
1315
GitHubAppId = "appid", GitHubAppPrivateKey = "appprivatekey", GitHubWebhookSecret = "webhooksecret"
1416
};
1517

18+
1619
public static GitHubMonitorFunction Create(IEventDispatchService dispatchService = null)
17-
=> new(dispatchService ?? new Mock<IEventDispatchService>().Object, Options.Create(AppConfig), new Mock<ILogger<GitHubMonitorFunction>>().Object);
20+
{
21+
var configValues = new Dictionary<string, string>
22+
{
23+
{ "GitHubMonitorConfig:test:GitHubAppId", AppConfig.GitHubAppId },
24+
{ "GitHubMonitorConfig:test:GitHubAppPrivateKey", AppConfig.GitHubAppPrivateKey },
25+
{ "GitHubMonitorConfig:test:GitHubWebhookSecret", AppConfig.GitHubWebhookSecret }
26+
};
27+
28+
var configuration = new ConfigurationBuilder()
29+
.AddInMemoryCollection(configValues)
30+
.Build();
31+
32+
return new GitHubMonitorFunction(
33+
dispatchService ?? new Mock<IEventDispatchService>().Object, new Mock<ILogger<GitHubMonitorFunction>>().Object, configuration);
34+
}
1835
}

0 commit comments

Comments
 (0)