Skip to content

Commit

Permalink
Update CoreEx and UnitTestEx dependencies (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
chullybun authored Apr 28, 2023
1 parent 81e1bf9 commit c06795d
Show file tree
Hide file tree
Showing 31 changed files with 100 additions and 91 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Represents the **NuGet** versions.

## v5.3.1
- *Fixed:* Upgraded `CoreEx` and `UnitTestEx` to latest packages to include all related fixes.

## v5.3.0
- *Enhancement:* Added new code-generation configuration property `ValidationFramework` that supports either `CoreEx` (default) or `FluentValidation` (uses the `CoreEx.FluentValidation` interop wrapping capabilities) to allow entity validation to be performed using either framework. Supports mix-and-matching where required. The `CoreEx.Validation` framework is still leveraged for `IsMandatory` and `ValidatorCode` logic where specified.
- *[Issue 208](https://github.com/Avanade/Beef/issues/208): `ReferenceDataController.GetNamed` now excluded from Swagger output as results in superfluous types/models.
Expand Down
2 changes: 1 addition & 1 deletion Common.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>5.3.0</Version>
<Version>5.3.1</Version>
<LangVersion>preview</LangVersion>
<Authors>Avanade</Authors>
<Company>Avanade</Company>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Folder Include="DataSvc\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx.Cosmos" Version="2.9.0" />
<PackageReference Include="CoreEx.Validation" Version="2.9.0" />
<PackageReference Include="CoreEx.Cosmos" Version="2.10.0" />
<PackageReference Include="CoreEx.Validation" Version="2.10.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<Folder Include="Entities\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.1" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions samples/Demo/Beef.Demo.Business/Beef.Demo.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx.Cosmos" Version="2.9.0" />
<PackageReference Include="CoreEx.Database" Version="2.9.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.9.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.9.0" />
<PackageReference Include="CoreEx.Validation" Version="2.9.0" />
<PackageReference Include="CoreEx.FluentValidation" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
<PackageReference Include="CoreEx.Cosmos" Version="2.10.0" />
<PackageReference Include="CoreEx.Database" Version="2.10.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.10.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.10.0" />
<PackageReference Include="CoreEx.Validation" Version="2.10.0" />
<PackageReference Include="CoreEx.FluentValidation" Version="2.10.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.16" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.Common/Beef.Demo.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Folder Include="Agents\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
<PackageReference Include="Grpc.Tools" Version="2.45.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion samples/Demo/Beef.Demo.Test/Beef.Demo.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.1" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions samples/My.Hr/My.Hr.Business/My.Hr.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.9.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.9.0" />
<PackageReference Include="CoreEx.Validation" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.10.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.10.0" />
<PackageReference Include="CoreEx.Validation" Version="2.10.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.16" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/My.Hr/My.Hr.Common/My.Hr.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions samples/My.Hr/My.Hr.Test/My.Hr.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.1" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/MyEf.Hr/MyEf.Hr.Api/MyEf.Hr.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx.Azure" Version="2.9.0" />
<PackageReference Include="CoreEx.Azure" Version="2.10.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions samples/MyEf.Hr/MyEf.Hr.Business/MyEf.Hr.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.9.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.9.0" />
<PackageReference Include="CoreEx.Validation" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
<PackageReference Include="CoreEx.Database.SqlServer" Version="2.10.0" />
<PackageReference Include="CoreEx.EntityFrameworkCore" Version="2.10.0" />
<PackageReference Include="CoreEx.Validation" Version="2.10.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.16" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/MyEf.Hr/MyEf.Hr.Common/MyEf.Hr.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CoreEx" Version="2.9.0" />
<PackageReference Include="CoreEx" Version="2.10.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CoreEx.Azure" Version="2.9.0" />
<PackageReference Include="CoreEx.Validation" Version="2.9.0" />
<PackageReference Include="CoreEx.Azure" Version="2.10.0" />
<PackageReference Include="CoreEx.Validation" Version="2.10.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.9.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public OktaHttpClient(HttpClient client, SecuritySettings settings, IJsonSeriali
public async Task<OktaUser?> GetUser(string email)
{
var response = await GetAsync<List<OktaUser>>($"/api/v1/users?search=profile.email eq \"{email}\"").ConfigureAwait(false);
return response.Value.SingleOrDefault();
return response.Value.Count == 1 ? response.Value[0] : null;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class SecuritySubscriberFunction

[Singleton(Mode = SingletonMode.Function)]
[FunctionName(nameof(SecuritySubscriberFunction))]
[ExponentialBackoffRetry(3, "00:02:00", "00:30:00")]
public Task RunAsync([ServiceBusTrigger("%ServiceBusQueueName%", Connection = "ServiceBusConnectionString")] ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions, CancellationToken cancellationToken)
=> _subscriber.ReceiveAsync(message, messageActions, cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public EmployeeTerminatedSubcriber(OktaHttpClient okta, ILogger<EmployeeTerminat

public override async Task ReceiveAsync(EventData<Employee> @event, CancellationToken cancellationToken)
{
var user = await _okta.GetUser(@event.Value.Email!).ConfigureAwait(false) ?? throw new NotFoundException($"Employee {@event.Value.Id} with email {@event.Value.Email} not found in OKTA.");
var user = await _okta.GetUser(@event.Value.Email!).ConfigureAwait(false) ?? throw new NotFoundException($"Employee {@event.Value.Id} with email {@event.Value.Email} either not found, or multiple exist, within OKTA.");

if (!user.IsDeactivatable)
_logger.LogWarning("Employee {EmployeeId} with email {Email} has User status of {UserStatus} and is therefore unable to be deactivated.", @event.Value.Id, @event.Value.Email, user.Status);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
"BaseUri": "https://dev-1234.okta.com",
"HttpRetryCount": 2,
"HttpTimeoutSeconds": 120
},
"ServiceBusOrchestratedSubscriber": {
"AbandonOnTransient": true,
"RetryDelay": "00:00:05"
}
}
6 changes: 3 additions & 3 deletions samples/MyEf.Hr/MyEf.Hr.Security.Subscriptions/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"serviceBus": {
"clientRetryOptions": {
"mode": "exponential",
"tryTimeout": "00:05:00",
"delay": "00:00:30.00",
"maxDelay": "00:03:00",
"tryTimeout": "00:01:00",
"delay": "00:00:00.80",
"maxDelay": "00:01:00",
"maxRetries": 3
},
"prefetchCount": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.1" />
<PackageReference Include="UnitTestEx.NUnit" Version="2.2.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,27 @@ public class SecuritySubscriberFunctionTest
public void InvalidMessage_DeadLetter()
{
using var test = FunctionTester.Create<Startup>();
var actionsMock = new Mock<ServiceBusMessageActions>();
var actions = test.CreateServiceBusMessageActions();
var message = test.CreateServiceBusMessage<string>(null!);

test.ServiceBusTrigger<SecuritySubscriberFunction>()
.ExpectLogContains("[EventDataDeserialization]")
.Run(f => f.RunAsync(message, actionsMock.Object, default))
.Run(f => f.RunAsync(message, actions, default))
.AssertSuccess();

actionsMock.Verify(m => m.DeadLetterMessageAsync(message, It.IsAny<string>(), It.IsAny<string>(), default), Times.Once);
actionsMock.VerifyNoOtherCalls();
actions.AssertDeadLetter("EventDataDeserialization", "Cannot decode JSON element of kind 'Null' as CloudEvent");
}

[Test]
public void NotSubscribed_CompleteSilent()
{
using var test = FunctionTester.Create<Startup>();
var actionsMock = new Mock<ServiceBusMessageActions>();
var actions = test.CreateServiceBusMessageActions();
var message = test.CreateServiceBusMessage(new EventData { Subject = "myef.hr.employee", Action = "updated", Source = new Uri("test", UriKind.Relative) });

test.ServiceBusTrigger<SecuritySubscriberFunction>()
.Run(f => f.RunAsync(message, actionsMock.Object, default))
.Run(f => f.RunAsync(message, actions, default))
.AssertSuccess();

actionsMock.Verify(m => m.CompleteMessageAsync(message, default), Times.Once);
actionsMock.VerifyNoOtherCalls();
actions.AssertComplete();
}
}
Loading

0 comments on commit c06795d

Please sign in to comment.