Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Updating to MediatR 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Oct 8, 2020
1 parent 014802e commit 1ed8e74
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
<PackageReference Include="MediatR" Version="8.1.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.3.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.3.1" PrivateAssets="All" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ public static void AddRequiredServices(IServiceCollection services, MediatRServi
// Use TryAdd, so any existing ServiceFactory/IMediator registration doesn't get overriden
services.TryAddTransient<ServiceFactory>(p => p.GetService);
services.TryAdd(new ServiceDescriptor(typeof(IMediator), serviceConfiguration.MediatorImplementationType, serviceConfiguration.Lifetime));
services.TryAdd(new ServiceDescriptor(typeof(ISender), sp => sp.GetService<IMediator>(), serviceConfiguration.Lifetime));
services.TryAdd(new ServiceDescriptor(typeof(IPublisher), sp => sp.GetService<IMediator>(), serviceConfiguration.Lifetime));

// Use TryAddTransientExact (see below), we dó want to register our Pre/Post processor behavior, even if (a more concrete)
// registration for IPipelineBehavior<,> already exists. But only once.
Expand Down
19 changes: 0 additions & 19 deletions src/TestApp/Properties/AssemblyInfo.cs

This file was deleted.

13 changes: 6 additions & 7 deletions src/TestApp/TestApp.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AssemblyName>TestApp</AssemblyName>
<TargetFramework>netcoreapp3.1</TargetFramework>
<OutputType>Exe</OutputType>
<PackageId>TestApp</PackageId>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MediatR.Extensions.Microsoft.DependencyInjection\MediatR.Extensions.Microsoft.DependencyInjection.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.8" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1</TargetFrameworks>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>MediatR.Extensions.Microsoft.DependencyInjection.Tests</AssemblyName>
<PackageId>MediatR.Extensions.Microsoft.DependencyInjection.Tests</PackageId>
Expand All @@ -16,13 +16,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Shouldly" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.8" />
<PackageReference Include="structuremap" Version="4.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MediatR.Extensions.Microsoft.DependencyInjection.Tests")]
[assembly: AssemblyTrademark("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a93a7f85-292a-4130-891d-4307d3f60c30")]
[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)]
[assembly: Xunit.CollectionBehavior(DisableTestParallelization = true)]
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public void ShouldResolveMediator()
_provider.GetService<IMediator>().ShouldNotBeNull();
}

[Fact]
public void ShouldResolveSender()
{
_provider.GetService<ISender>().ShouldNotBeNull();
}

[Fact]
public void ShouldResolvePublisher()
{
_provider.GetService<IPublisher>().ShouldNotBeNull();
}

[Fact]
public void ShouldResolveRequestHandler()
{
Expand Down

0 comments on commit 1ed8e74

Please sign in to comment.