diff --git a/src/dependency-core/Core.Tests/Dependency.Core.Tests.csproj b/src/dependency-core/Core.Tests/Dependency.Core.Tests.csproj index 347fe9b..00033f6 100644 --- a/src/dependency-core/Core.Tests/Dependency.Core.Tests.csproj +++ b/src/dependency-core/Core.Tests/Dependency.Core.Tests.csproj @@ -19,7 +19,7 @@ - + @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/src/dependency-core/Core.Tests/Tests.Dependency/Pipe/Pipe.cs b/src/dependency-core/Core.Tests/Tests.Dependency/Pipe/Pipe.cs new file mode 100644 index 0000000..8139b0f --- /dev/null +++ b/src/dependency-core/Core.Tests/Tests.Dependency/Pipe/Pipe.cs @@ -0,0 +1,30 @@ +using System; +using PrimeFuncPack.UnitTest; +using Xunit; + +namespace PrimeFuncPack.Tests; + +partial class DependencyTest +{ + [Fact] + public void Pipe_DependencyIsNull_ExpectArgumentNullException() + { + var ex = Assert.Throws(InnerTest); + Assert.Equal("dependency", ex.ParamName); + + static void InnerTest() + => + Dependency.Pipe(null!); + } + + [Theory] + [MemberData(nameof(TestEntitySource.RefTypes), MemberType = typeof(TestEntitySource))] + public void Pipe_DependencyIsNotNull_ExpectSameDependency( + RefType sourceValue) + { + var source = Dependency.From(_ => sourceValue); + var actual = Dependency.Pipe(source); + + Assert.Same(source, actual); + } +} \ No newline at end of file diff --git a/src/dependency-core/Core/Dependency/Pipe/Pipe.cs b/src/dependency-core/Core/Dependency/Pipe/Pipe.cs new file mode 100644 index 0000000..87e36ca --- /dev/null +++ b/src/dependency-core/Core/Dependency/Pipe/Pipe.cs @@ -0,0 +1,10 @@ +using System; + +namespace PrimeFuncPack; + +partial class Dependency +{ + public static Dependency Pipe(Dependency dependency) + => + dependency ?? throw new ArgumentNullException(nameof(dependency)); +} \ No newline at end of file diff --git a/src/dependency-service-provider-extensions/ServiceProviderExtensions.Tests/ServiceProviderExtensions.Tests.csproj b/src/dependency-service-provider-extensions/ServiceProviderExtensions.Tests/ServiceProviderExtensions.Tests.csproj index 01e854d..44aff81 100644 --- a/src/dependency-service-provider-extensions/ServiceProviderExtensions.Tests/ServiceProviderExtensions.Tests.csproj +++ b/src/dependency-service-provider-extensions/ServiceProviderExtensions.Tests/ServiceProviderExtensions.Tests.csproj @@ -19,7 +19,7 @@ - +