Skip to content

Commit 24fae7d

Browse files
committed
Updated github-monitor so that running one instance is sufficient
1 parent 997e34e commit 24fae7d

40 files changed

+247
-155
lines changed

github-monitor/Ahk.GitHub.Monitor.Tests/IntegrationTests/FunctionInvokeTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System.Threading.Tasks;
2+
using Ahk.GitHub.Monitor.Config;
23
using Ahk.GitHub.Monitor.Services.EventDispatch;
34
using Microsoft.AspNetCore.Http;
45
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.Extensions.Configuration;
57
using Microsoft.Extensions.Logging;
68
using Microsoft.Extensions.Logging.Abstractions;
79
using Microsoft.Extensions.Options;
@@ -18,7 +20,8 @@ public async Task NoAppConfigsReturnsError()
1820
{
1921
var log = new Mock<ILogger<GitHubMonitorFunction>>();
2022
var eds = new Mock<IEventDispatchService>();
21-
var func = new GitHubMonitorFunction(eds.Object, Options.Create(new GitHubMonitorConfig()), log.Object);
23+
var mockConfiguration = new Mock<IConfiguration>();
24+
var func = new GitHubMonitorFunction(eds.Object, log.Object, mockConfiguration.Object);
2225

2326
ObjectResult resp = await func.InvokeAndGetResponseAs<ObjectResult>(req => { });
2427

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Ahk.GitHub.Monitor.Config;
12
using Ahk.GitHub.Monitor.Services.EventDispatch;
23
using Microsoft.Extensions.Logging;
34
using Microsoft.Extensions.Options;
@@ -13,7 +14,5 @@ internal static class FunctionBuilder
1314
};
1415

1516
public static GitHubMonitorFunction Create(IEventDispatchService dispatchService = null)
16-
=> new(dispatchService ?? new Mock<IEventDispatchService>().Object,
17-
Options.Create(AppConfig),
18-
new Mock<ILogger<GitHubMonitorFunction>>().Object);
17+
=> new(dispatchService ?? new Mock<IEventDispatchService>().Object, Options.Create(AppConfig), new Mock<ILogger<GitHubMonitorFunction>>().Object);
1918
}

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/ConfigYamlParserTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Ahk.GitHub.Monitor.EventHandlers;
2+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
23
using Microsoft.VisualStudio.TestTools.UnitTesting;
34

45
namespace Ahk.GitHub.Monitor.Tests.UnitTests;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventDispatchServiceTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Threading.Tasks;
22
using Ahk.GitHub.Monitor.EventHandlers;
3+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
34
using Ahk.GitHub.Monitor.Services;
45
using Ahk.GitHub.Monitor.Services.EventDispatch;
56
using Ahk.GitHub.Monitor.Tests.UnitTests.EventHandlersTests.Helpers;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/ActionWorkflowRunHandlerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Threading.Tasks;
22
using Ahk.GitHub.Monitor.EventHandlers;
3+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
34
using Ahk.GitHub.Monitor.Services;
45
using Ahk.GitHub.Monitor.Tests.UnitTests.EventHandlersTests.Helpers;
56
using Microsoft.Extensions.DependencyInjection;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/BranchProtectionRuleHandlerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Threading.Tasks;
22
using Ahk.GitHub.Monitor.EventHandlers;
3+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
34
using Ahk.GitHub.Monitor.Tests.UnitTests.EventHandlersTests.Helpers;
45
using Microsoft.Extensions.Logging.Abstractions;
56
using Microsoft.VisualStudio.TestTools.UnitTesting;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/GradeCommandHandlerTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
33
using Ahk.GitHub.Monitor.EventHandlers;
4+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
45
using Ahk.GitHub.Monitor.EventHandlers.GradeComment;
5-
using Ahk.GitHub.Monitor.EventHandlers.StatusTracking;
66
using Ahk.GitHub.Monitor.Services;
77
using Ahk.GitHub.Monitor.Services.GradeStore;
88
using Ahk.GitHub.Monitor.Services.StatusTrackingStore;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/Helpers/GitHubClientMockFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static GitHubClientMockFactory CreateDefault()
4949
public IGitHubClientFactory CreateFactory()
5050
{
5151
var factoryMock = new Mock<IGitHubClientFactory>();
52-
factoryMock.Setup(f => f.CreateGitHubClient(It.IsAny<long>(), NullLogger<GitHubMonitorFunction>.Instance))
52+
factoryMock.Setup(f => f.CreateGitHubClient(It.IsAny<string>(), It.IsAny<long>(), NullLogger<GitHubMonitorFunction>.Instance))
5353
.ReturnsAsync(this.GitHubClientMock.Object);
5454
return factoryMock.Object;
5555
}

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/IssueCommentEditDeleteHandlerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Threading.Tasks;
22
using Ahk.GitHub.Monitor.EventHandlers;
3+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
34
using Ahk.GitHub.Monitor.Tests.UnitTests.EventHandlersTests.Helpers;
45
using Microsoft.Extensions.Logging.Abstractions;
56
using Microsoft.VisualStudio.TestTools.UnitTesting;

github-monitor/Ahk.GitHub.Monitor.Tests/UnitTests/EventHandlersTests/PullRequestOpenDuplicateHandlerTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Threading.Tasks;
22
using Ahk.GitHub.Monitor.EventHandlers;
3+
using Ahk.GitHub.Monitor.EventHandlers.BaseAndUtils;
34
using Ahk.GitHub.Monitor.Tests.UnitTests.EventHandlersTests.Helpers;
45
using Microsoft.Extensions.Logging.Abstractions;
56
using Microsoft.VisualStudio.TestTools.UnitTesting;

0 commit comments

Comments
 (0)