-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dotnet new beef targets .NET 8
- Loading branch information
Showing
27 changed files
with
169 additions
and
165 deletions.
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
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
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
14 changes: 7 additions & 7 deletions
14
samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/GlobalUsings.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
global using Azure.Messaging.ServiceBus; | ||
global using CoreEx; | ||
global using CoreEx.Events; | ||
global using CoreEx.Events.Subscribing; | ||
global using CoreEx.Azure.ServiceBus; | ||
global using CoreEx.Configuration; | ||
global using CoreEx.Events; | ||
global using CoreEx.Events.Subscribing; | ||
global using CoreEx.Hosting; | ||
global using CoreEx.Http; | ||
global using CoreEx.Json; | ||
global using CoreEx.RefData; | ||
global using CoreEx.Results; | ||
global using CoreEx.Validation; | ||
global using Microsoft.Azure.Functions.Extensions.DependencyInjection; | ||
global using Microsoft.Azure.WebJobs; | ||
global using Microsoft.Azure.WebJobs.ServiceBus; | ||
global using Microsoft.Azure.Functions.Worker; | ||
global using Microsoft.Extensions.Configuration; | ||
global using Microsoft.Extensions.DependencyInjection; | ||
global using Microsoft.Extensions.Hosting; | ||
global using Microsoft.Extensions.Logging; | ||
global using MyEf.Hr.Common.Entities; | ||
global using System; | ||
global using System.Collections.Generic; | ||
global using System.Linq; | ||
global using System.Text; | ||
global using System.Threading.Tasks; | ||
global using System.Threading.Tasks; | ||
global using MyEf.Hr.Common.Entities; |
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,9 @@ | ||
new HostBuilder() | ||
.ConfigureFunctionsWorkerDefaults() | ||
.ConfigureServices(services => | ||
{ | ||
services.AddApplicationInsightsTelemetryWorkerService(); | ||
services.ConfigureFunctionsApplicationInsights(); | ||
}) | ||
.ConfigureHostStartup<MyEf.Hr.Security.Subscriptions.Startup>() | ||
.Build().Run(); |
9 changes: 3 additions & 6 deletions
9
samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/SecuritySubscriberFunction.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 |
---|---|---|
@@ -1,13 +1,10 @@ | ||
namespace MyEf.Hr.Security.Subscriptions; | ||
|
||
public class SecuritySubscriberFunction | ||
public class SecuritySubscriberFunction(ServiceBusOrchestratedSubscriber subscriber) | ||
{ | ||
private readonly ServiceBusOrchestratedSubscriber _subscriber; | ||
private readonly ServiceBusOrchestratedSubscriber _subscriber = subscriber.ThrowIfNull(); | ||
|
||
public SecuritySubscriberFunction(ServiceBusOrchestratedSubscriber subscriber) => _subscriber = subscriber ?? throw new ArgumentNullException(nameof(subscriber)); | ||
|
||
[Singleton(Mode = SingletonMode.Function)] | ||
[FunctionName(nameof(SecuritySubscriberFunction))] | ||
[Function(nameof(SecuritySubscriberFunction))] | ||
public Task RunAsync([ServiceBusTrigger("%ServiceBusQueueName%", Connection = "ServiceBusConnectionString")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions, CancellationToken cancellationToken) | ||
=> _subscriber.ReceiveAsync(message, messageActions, null, cancellationToken); | ||
} |
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
3 changes: 1 addition & 2 deletions
3
samples/MyEf.Hr/MyEf.Hr.Security.Test/MyEf.Hr.Security.Test.csproj
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
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 |
---|---|---|
|
@@ -8,7 +8,7 @@ public void ValueIsRequired_DeadLetter() | |
{ | ||
using var test = FunctionTester.Create<Startup>(); | ||
var message = test.CreateServiceBusMessage(new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = null! }); | ||
var actions = test.CreateServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
|
||
test.ServiceBusTrigger<SecuritySubscriberFunction>() | ||
.Run(f => f.RunAsync(message, actions, default)) | ||
|
@@ -22,7 +22,7 @@ public void ValidationError_DeadLetter() | |
{ | ||
using var test = FunctionTester.Create<Startup>(); | ||
var message = test.CreateServiceBusMessage(new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee() }); | ||
var actions = test.CreateServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
|
||
test.ServiceBusTrigger<SecuritySubscriberFunction>() | ||
.ExpectLogContains("A data validation error occurred") | ||
|
@@ -40,7 +40,7 @@ public void EmailNotFound_None_Complete() | |
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson("[]", HttpStatusCode.OK); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
@@ -62,7 +62,7 @@ public void EmailNotFound_Multi_Complete() | |
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson("[{},{}]", HttpStatusCode.OK); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
@@ -84,7 +84,7 @@ public void OktaForbidden_Retry() | |
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.With(HttpStatusCode.Forbidden); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateWebJobsServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
@@ -111,7 +111,7 @@ public void OktaServiceUnavailable_Retry() | |
}); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateWebJobsServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
@@ -134,7 +134,7 @@ public void SuccessDeactivated_Complete() | |
mc.Request(HttpMethod.Post, "/api/v1/users/00ub0oNGTSWTBKOLGLNR/lifecycle/deactivate?sendEmail=true").Respond.With(HttpStatusCode.OK); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateWebJobsServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
@@ -155,7 +155,7 @@ public void SuccessAlreadyDeactivated_Complete() | |
mc.Request(HttpMethod.Get, "/api/v1/users?search=profile.email eq \"[email protected]\"").Respond.WithJson(new [] { new { id = "00ub0oNGTSWTBKOLGLNR", status = "DEACTIVATED" } }); | ||
|
||
using var test = FunctionTester.Create<Startup>(); | ||
var actions = test.CreateWebJobsServiceBusMessageActions(); | ||
var actions = test.CreateWorkerServiceBusMessageActions(); | ||
var message = test.CreateServiceBusMessage( | ||
new EventData<Employee> { Subject = "myef.hr.employee", Action = "terminated", Source = new Uri("test", UriKind.Relative), Value = new Employee { Id = 1.ToGuid(), Email = "[email protected]", Termination = new() } }); | ||
|
||
|
Oops, something went wrong.