diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 74e9667..1699ee0 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "dotnet-sonarscanner": { - "version": "9.0.2", + "version": "11.1.0", "commands": [ "dotnet-sonarscanner" ] diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6af9d71..b112434 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,23 @@ version: 2 updates: - package-ecosystem: "github-actions" - directory: "/" # Location of package manifests + directory: "/" schedule: - interval: "weekly" + interval: "monthly" labels: - "dependencies" - "github-actions" + - package-ecosystem: "nuget" + directory: "/" + schedule: + interval: "monthly" + ignore: + - dependency-name: "AutoMapper" + - dependency-name: "AutoMapper.Collection" + - dependency-name: "*" + update-types: + - "version-update:semver-patch" + labels: + - "dependencies" + - "nuget" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 06304e1..cf0d624 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,8 @@ on: env: SOURCE_DIRECTORY: ${{ github.workspace }} - SOLUTION_FILE: "OLT.DataAdapters.AutoMapper.sln" + SOLUTION_FILE: "OLT.DataAdapters.AutoMapper.slnx" + AUTOMAPPER_LICENSE_KEY: ${{ secrets.AUTOMAPPER_LICENSE_KEY }} jobs: build: @@ -34,6 +35,7 @@ jobs: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Get branch name id: branch-name diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fae1351..de0da1e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: env: PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output SOURCE_DIRECTORY: ${{ github.workspace }} - SOLUTION_FILE: "OLT.DataAdapters.AutoMapper.sln" + SOLUTION_FILE: "OLT.DataAdapters.AutoMapper.slnx" NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json" jobs: @@ -23,6 +23,7 @@ jobs: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Get Version id: get_version diff --git a/OLT.DataAdapters.AutoMapper.sln b/OLT.DataAdapters.AutoMapper.sln deleted file mode 100644 index ef23379..0000000 --- a/OLT.DataAdapters.AutoMapper.sln +++ /dev/null @@ -1,62 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 18 -VisualStudioVersion = 18.0.11205.157 d18.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.DataAdapters.AutoMapper", "src\OLT.DataAdapters.AutoMapper\OLT.DataAdapters.AutoMapper.csproj", "{07F972FB-E132-4FBF-B52F-DC18A2FFB622}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.DataAdapters.AutoMapper.Tests", "tests\OLT.DataAdapters.AutoMapper.Tests\OLT.DataAdapters.AutoMapper.Tests.csproj", "{CADA4C2D-8842-46DB-899F-F67A32459A57}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OLT.Extensions.DependencyInjection.AutoMapper", "src\OLT.Extensions.DependencyInjection.AutoMapper\OLT.Extensions.DependencyInjection.AutoMapper.csproj", "{C956C04F-4523-4F68-961C-8174803AA073}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{D6AD39E5-20A1-48BA-A4BC-CC192F55B453}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0D8B221D-7865-4CEC-B2FA-77BF7F012A5E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".workflow", ".workflow", "{4633489B-3578-43A5-BBB6-8B4AE58EA573}" - ProjectSection(SolutionItems) = preProject - .github\workflows\build.yml = .github\workflows\build.yml - .github\dependabot.yml = .github\dependabot.yml - .github\workflows\release.yml = .github\workflows\release.yml - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{FF532B3D-4994-4AAE-870F-FDACD6A537C8}" - ProjectSection(SolutionItems) = preProject - .config\dotnet-tools.json = .config\dotnet-tools.json - README.md = README.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {07F972FB-E132-4FBF-B52F-DC18A2FFB622}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {07F972FB-E132-4FBF-B52F-DC18A2FFB622}.Debug|Any CPU.Build.0 = Debug|Any CPU - {07F972FB-E132-4FBF-B52F-DC18A2FFB622}.Release|Any CPU.ActiveCfg = Release|Any CPU - {07F972FB-E132-4FBF-B52F-DC18A2FFB622}.Release|Any CPU.Build.0 = Release|Any CPU - {CADA4C2D-8842-46DB-899F-F67A32459A57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CADA4C2D-8842-46DB-899F-F67A32459A57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CADA4C2D-8842-46DB-899F-F67A32459A57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CADA4C2D-8842-46DB-899F-F67A32459A57}.Release|Any CPU.Build.0 = Release|Any CPU - {C956C04F-4523-4F68-961C-8174803AA073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C956C04F-4523-4F68-961C-8174803AA073}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C956C04F-4523-4F68-961C-8174803AA073}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C956C04F-4523-4F68-961C-8174803AA073}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {07F972FB-E132-4FBF-B52F-DC18A2FFB622} = {D6AD39E5-20A1-48BA-A4BC-CC192F55B453} - {CADA4C2D-8842-46DB-899F-F67A32459A57} = {0D8B221D-7865-4CEC-B2FA-77BF7F012A5E} - {C956C04F-4523-4F68-961C-8174803AA073} = {D6AD39E5-20A1-48BA-A4BC-CC192F55B453} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E223F339-A690-4201-BE01-4B838E79657B} - EndGlobalSection -EndGlobal diff --git a/OLT.DataAdapters.AutoMapper.slnx b/OLT.DataAdapters.AutoMapper.slnx new file mode 100644 index 0000000..f9e9a69 --- /dev/null +++ b/OLT.DataAdapters.AutoMapper.slnx @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/OLT.DataAdapters.AutoMapper/OLT.DataAdapters.AutoMapper.csproj b/src/OLT.DataAdapters.AutoMapper/OLT.DataAdapters.AutoMapper.csproj index 3dd96d6..421f719 100644 --- a/src/OLT.DataAdapters.AutoMapper/OLT.DataAdapters.AutoMapper.csproj +++ b/src/OLT.DataAdapters.AutoMapper/OLT.DataAdapters.AutoMapper.csproj @@ -1,6 +1,6 @@  - net9.0;net8.0 + net10.0;net9.0;net8.0 OLT.Core DataAdapters AutoMapper Library 07F972FB-E132-4FBF-B52F-DC18A2FFB622 @@ -9,12 +9,12 @@ - - + + - + \ No newline at end of file diff --git a/src/OLT.Extensions.DependencyInjection.AutoMapper/OLT.Extensions.DependencyInjection.AutoMapper.csproj b/src/OLT.Extensions.DependencyInjection.AutoMapper/OLT.Extensions.DependencyInjection.AutoMapper.csproj index a7cff30..e4c7710 100644 --- a/src/OLT.Extensions.DependencyInjection.AutoMapper/OLT.Extensions.DependencyInjection.AutoMapper.csproj +++ b/src/OLT.Extensions.DependencyInjection.AutoMapper/OLT.Extensions.DependencyInjection.AutoMapper.csproj @@ -1,7 +1,7 @@  - net9.0;net8.0 + net10.0;net9.0;net8.0 OLT.Core Auto Mapper Extensions for Data Adapters c956c04f-4523-4f68-961c-8174803aa073 @@ -9,9 +9,8 @@ - - - + + diff --git a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperAssemblyFilter.cs b/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperAssemblyFilter.cs deleted file mode 100644 index f9c2708..0000000 --- a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperAssemblyFilter.cs +++ /dev/null @@ -1,105 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using OLT.Utility.AssemblyScanner; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace OLT.Core -{ - - /// - /// Assembly Scan Filter - /// - [Obsolete("Move to OLT.Utility.AssemblyScanner")] - public class OltAutoMapperAssemblyFilter - { - - /// - /// OLT.*, MyApp.*, and includes exclustions - /// - /// - public OltAutoMapperAssemblyFilter(params string[] filters) - { - Filters.AddRange(filters); - WithDefaultDIExclusionFilters(); - } - - - /// - /// Defaults "Microsoft.*" and "System.*" to prevent Microsoft and System Assemblies from loading into the DI scan - /// - /// - /// - /// https://github.com/dotnet/SqlClient/issues/1930 - /// https://github.com/borisdj/EFCore.BulkExtensions/issues/1402 - /// - /// - public OltAutoMapperAssemblyFilter WithDefaultDIExclusionFilters() - { - this.ExcludeFilters = new List { "Microsoft.*", "System.*" }; - return this; - } - - public List Filters { get; set; } = new List(); - public List ExcludeFilters { get; set; } = new List(); - - public virtual IEnumerable FilterAssemblies(IEnumerable assemblies) - { - if (Filters.Count > 0 || ExcludeFilters.Count > 0) - { - var filtered = Filters.Count > 0 ? assemblies.Where(ShouldIncludeAssembly) : assemblies; - return ExcludeFilters.Count > 0 ? filtered.Where(p => ShouldExcludeAssembly(p) == false) : filtered; - } - - return assemblies; - } - - - - public virtual bool ShouldIncludeAssembly(Assembly assembly) - { - return Filters.Exists(filter => MatchesFilter(assembly, filter)); - } - - protected virtual bool MatchesFilter(Assembly assembly, string filter) - { - if (string.IsNullOrEmpty(filter)) - { - return false; - } - - if (assembly.FullName is null) - { - return false; - } - - if (filter.EndsWith("*")) - { - var prefix = filter.TrimEnd('*'); - return assembly.FullName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase); - } - else - { - var assemblyName = assembly.FullName.Split(',')[0]; - return string.Equals(assemblyName, filter, StringComparison.OrdinalIgnoreCase); - } - } - - public virtual bool ShouldExcludeAssembly(Assembly assembly) - { - return ExcludeFilters.Exists(filter => MatchesFilter(assembly, filter)); - } - - public virtual void RemoveAllExclusions(List assemblies) - { - ExcludeFilters.ForEach(excludeName => RemoveAll(assemblies, excludeName)); - } - - public virtual void RemoveAll(List assemblies, string excludeName) - { - assemblies.RemoveAll(p => MatchesFilter(p, excludeName)); - } - - } -} diff --git a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperBuilder.cs b/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperBuilder.cs index 957caae..a49a373 100644 --- a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperBuilder.cs +++ b/src/OLT.Extensions.DependencyInjection.AutoMapper/OltAutoMapperBuilder.cs @@ -85,13 +85,17 @@ public virtual OltAutoMapperBuilder AddProfiles(params Profile[] profiles) /// /// Builds the AutoMapper configuration and registers the necessary services. /// + /// License key for AutoMapper. /// An optional action to configure the AutoMapper. - public virtual void Build(Action? configAction = null) + public virtual void Build(string licenseKey, Action? configAction = null) { + ArgumentException.ThrowIfNullOrEmpty(licenseKey); + _services.AddSingleton(); _services.AddAutoMapper(cfg => { + cfg.LicenseKey = licenseKey; cfg.AddCollectionMappers(); cfg.AddProfiles(_profiles); configAction?.Invoke(cfg); diff --git a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltServiceCollectionAutoMapperExtensions.cs b/src/OLT.Extensions.DependencyInjection.AutoMapper/OltServiceCollectionAutoMapperExtensions.cs index 92b1697..8662623 100644 --- a/src/OLT.Extensions.DependencyInjection.AutoMapper/OltServiceCollectionAutoMapperExtensions.cs +++ b/src/OLT.Extensions.DependencyInjection.AutoMapper/OltServiceCollectionAutoMapperExtensions.cs @@ -1,127 +1,28 @@ -using AutoMapper; -using Microsoft.Extensions.DependencyInjection; -using OLT.Utility.AssemblyScanner; +using Microsoft.Extensions.DependencyInjection; using System; -using System.Collections.Generic; -using System.Reflection; -namespace OLT.Core -{ +namespace OLT.Core; +/// +/// Provides extension methods for adding AutoMapper services to the IServiceCollection. +/// +public static class OltServiceCollectionAutoMapperExtensions +{ /// - /// Provides extension methods for adding AutoMapper services to the IServiceCollection. + /// Adds AutoMapper services to the IServiceCollection. /// - public static class OltServiceCollectionAutoMapperExtensions + /// The IServiceCollection to add the services to. + /// License key for AutoMapper. + /// An action to configure the OltAutoMapperBuilder. + /// The IServiceCollection with the added services. + public static IServiceCollection AddOltAutoMapper(this IServiceCollection services, string licenseKey, Action action) { - - /// - /// Adds AutoMapper services to the IServiceCollection. - /// - /// The IServiceCollection to add the services to. - /// An action to configure the OltAutoMapperBuilder. - /// The IServiceCollection with the added services. - public static IServiceCollection AddOltAutoMapper(this IServiceCollection services, Action action) - { - ArgumentNullException.ThrowIfNull(services); - var builder = new OltAutoMapperBuilder(services); - action(builder); - builder.Build(); - return services; - } - - - - /// - /// Scans for automapper profiles using - /// - /// The IServiceCollection to add the services to. - /// An optional filter to apply to the assembly scan. - /// The IServiceCollection with the added services. - [Obsolete("Use AddOltAutoMapper")] - public static IServiceCollection AddOltInjectionAutoMapper(this IServiceCollection services, OltAutoMapperAssemblyFilter? filter = null) - { - return AddOltInjectionAutoMapper(services, new List(), null, ServiceLifetime.Transient, filter); - } - - /// - /// Scans for automapper profiles using - /// - /// The IServiceCollection to add the services to. - /// The assembly to include in the scan. - /// An optional filter to apply to the assembly scan. - /// The IServiceCollection with the added services. - /// Thrown when includeAssemblyScan is null. - [Obsolete("Use AddOltAutoMapper")] - public static IServiceCollection AddOltInjectionAutoMapper(this IServiceCollection services, Assembly includeAssemblyScan, OltAutoMapperAssemblyFilter? filter = null) - { - if (includeAssemblyScan == null) - { - throw new ArgumentNullException(nameof(includeAssemblyScan)); - } - - return AddOltInjectionAutoMapper(services, new List { includeAssemblyScan }, null, ServiceLifetime.Transient, filter); - } - - /// - /// Scans for automapper profiles using - /// - /// The IServiceCollection to add the services to. - /// The list of assemblies to include in the scan. - /// An optional filter to apply to the assembly scan. - /// The IServiceCollection with the added services. - [Obsolete("Use AddOltAutoMapper")] - public static IServiceCollection AddOltInjectionAutoMapper(this IServiceCollection services, List includeAssembliesScan, OltAutoMapperAssemblyFilter? filter = null) - { - return AddOltInjectionAutoMapper(services, includeAssembliesScan, null, ServiceLifetime.Transient, filter); - } - - /// - /// Scans for automapper profiles using - /// - /// The IServiceCollection to add the services to. - /// The list of assemblies to include in the scan. - /// An optional action to configure the IMapperConfigurationExpression. - /// The lifetime of the services to add. - /// An optional filter to apply to the assembly scan. - /// The IServiceCollection with the added services. - /// Thrown when services is null. - [Obsolete("Use AddOltAutoMapper")] - public static IServiceCollection AddOltInjectionAutoMapper(this IServiceCollection services, List includeAssembliesScan, Action? configAction, ServiceLifetime serviceLifetime = ServiceLifetime.Transient, OltAutoMapperAssemblyFilter? filter = null) - { - ArgumentNullException.ThrowIfNull(services); - includeAssembliesScan = includeAssembliesScan ?? new List(); - filter = filter ?? new OltAutoMapperAssemblyFilter(); - - var baseAssemblies = new List - { - Assembly.GetExecutingAssembly() - }; - - var entryAssembly = Assembly.GetEntryAssembly(); - if (entryAssembly != null) - { - baseAssemblies.Add(entryAssembly); - } - - baseAssemblies.AddRange(includeAssembliesScan); - - var assemblyScanner = new OLT.Utility.AssemblyScanner.OltAssemblyScanBuilder(); - assemblyScanner - .IncludeAssembly(baseAssemblies) - .DeepScan() - .ExcludeFilter(filter.ExcludeFilters.ToArray()) - .IncludeFilter(filter.Filters.ToArray()) - .ExcludeAutomapper() - .ExcludeMicrosoft(); - - - var assembliesToScan = assemblyScanner.Build(); - - var builder = new OltAutoMapperBuilder(services); - builder.WithServiceLifetime(serviceLifetime); - builder.AddMaps(assembliesToScan); - builder.Build(configAction); - return services; - } + ArgumentNullException.ThrowIfNull(services); + ArgumentException.ThrowIfNullOrEmpty(licenseKey); + var builder = new OltAutoMapperBuilder(services); + action(builder); + builder.Build(licenseKey); + return services; } + } diff --git a/tests/OLT.DataAdapters.AutoMapper.Tests/BaseAdpaterTests.cs b/tests/OLT.DataAdapters.AutoMapper.Tests/BaseAdpaterTests.cs index 6d23214..0936ade 100644 --- a/tests/OLT.DataAdapters.AutoMapper.Tests/BaseAdpaterTests.cs +++ b/tests/OLT.DataAdapters.AutoMapper.Tests/BaseAdpaterTests.cs @@ -1,5 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; -using AutoMapper; +using AutoMapper; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using OLT.Core; using OLT.DataAdapters.AutoMapper.Tests.Adapters; using System.Collections.Generic; @@ -10,21 +11,31 @@ public abstract class BaseAdpaterTests { private readonly List DefaultMaps = new List { new AutoMapperMaps() }; - protected void RegisterMaps(IServiceCollection services, List maps) + protected void RegisterMaps(IServiceCollection services, IConfiguration configuration, List maps) { + var licenseKey = configuration.GetValue("AUTOMAPPER_LICENSE_KEY"); services.AddAutoMapper(cfg => { - maps.ForEach(map => cfg.AddProfile(map)); + cfg.LicenseKey = licenseKey; + maps.ForEach(map => cfg.AddProfile(map)); }); } protected ServiceProvider BuildProvider(List? maps = null) { + + var configuration = new ConfigurationBuilder() + .AddEnvironmentVariables() + .AddUserSecrets() + .Build(); + var services = new ServiceCollection(); + services.AddLogging(); + //using var loggerProvider = new InMemoryLoggerProvider(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - RegisterMaps(services, maps ?? DefaultMaps); + RegisterMaps(services, configuration, maps ?? DefaultMaps); return services.BuildServiceProvider(); } } diff --git a/tests/OLT.DataAdapters.AutoMapper.Tests/OLT.DataAdapters.AutoMapper.Tests.csproj b/tests/OLT.DataAdapters.AutoMapper.Tests/OLT.DataAdapters.AutoMapper.Tests.csproj index 1a441d0..13da038 100644 --- a/tests/OLT.DataAdapters.AutoMapper.Tests/OLT.DataAdapters.AutoMapper.Tests.csproj +++ b/tests/OLT.DataAdapters.AutoMapper.Tests/OLT.DataAdapters.AutoMapper.Tests.csproj @@ -1,20 +1,25 @@  - net8.0 + net10.0 enable + a0afd969-ee06-459b-838d-86e9620e2c00 - - - - - + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/OLT.DataAdapters.AutoMapper.Tests/OltServiceCollectionAutoMapperExtensionTests.cs b/tests/OLT.DataAdapters.AutoMapper.Tests/OltServiceCollectionAutoMapperExtensionTests.cs deleted file mode 100644 index 015ccb9..0000000 --- a/tests/OLT.DataAdapters.AutoMapper.Tests/OltServiceCollectionAutoMapperExtensionTests.cs +++ /dev/null @@ -1,80 +0,0 @@ -//using AutoMapper; -//using Microsoft.Extensions.DependencyInjection; -//using OLT.Core; -//using System; -//using System.Collections.Generic; -//using System.Reflection; -//using Xunit; - -//namespace OLT.Extensions.DependencyInjection.AutoMapper.Tests -//{ -// public class OltServiceCollectionAutoMapperExtensionTests -// { -// [Fact] -// public void ExceptionTest() -// { -// var services = new ServiceCollection(); -// Assembly nullRef = null; -// List nullList = null; -// Action configAction = null; - -// Assert.Throws("services", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(null)); - -// Assert.Throws("includeAssemblyScan", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(null, nullRef)); -// Assert.Throws("includeAssemblyScan", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(null, nullRef, new OltAutoMapperAssemblyFilter())); - -// Assert.Throws("services", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(null, nullList)); -// Assert.Throws("services", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(null, nullList, new OltAutoMapperAssemblyFilter())); - -// Assert.Throws("includeAssemblyScan", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, nullRef)); -// Assert.Throws("includeAssemblyScan", () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, nullRef, new OltAutoMapperAssemblyFilter())); - -// var act = () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, nullList); -// Assert.Throws(act); -// act.Should().NotThrow(); - -// act = () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, new List() { this.GetType().Assembly }, configAction); -// act.Should().NotThrow(); - -// act = () => OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, new List() { this.GetType().Assembly }, cfg => cfg.DisableConstructorMapping(), ServiceLifetime.Scoped); - -// act.Should().NotThrow(); -// } - -// [Fact] -// public void InjectionTest() -// { -// var services = new ServiceCollection(); -// OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services); - -// using (var provider = services.BuildServiceProvider()) -// { -// Assert.NotNull(provider.GetService()); -// } -// } - -// [Fact] -// public void InjectionAssemblyTest() -// { -// var services = new ServiceCollection(); -// OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, this.GetType().Assembly); - -// using (var provider = services.BuildServiceProvider()) -// { -// Assert.NotNull(provider.GetService()); -// } -// } - -// [Fact] -// public void InjectionAssemblyListTest() -// { -// var services = new ServiceCollection(); -// OltServiceCollectionAutoMapperExtensions.AddOltInjectionAutoMapper(services, new List() { this.GetType().Assembly }, cfg => cfg.DisableConstructorMapping(), ServiceLifetime.Scoped); - -// using (var provider = services.BuildServiceProvider()) -// { -// Assert.NotNull(provider.GetService()); -// } -// } -// } -//} \ No newline at end of file