Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dependency-core/Core.Tests/Dependency.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="PrimeFuncPack.UnitTest.Data" Version="3.1.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand All @@ -33,4 +33,4 @@
<PackageReference Include="xunit.v3" Version="3.2.2" />
</ItemGroup>

</Project>
</Project>
30 changes: 30 additions & 0 deletions src/dependency-core/Core.Tests/Tests.Dependency/Pipe/Pipe.cs
Original file line number Diff line number Diff line change
@@ -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<ArgumentNullException>(InnerTest);
Assert.Equal("dependency", ex.ParamName);

static void InnerTest()
=>
Dependency.Pipe<RefType>(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);
}
}
10 changes: 10 additions & 0 deletions src/dependency-core/Core/Dependency/Pipe/Pipe.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace PrimeFuncPack;

partial class Dependency
{
public static Dependency<T> Pipe<T>(Dependency<T> dependency)
=>
dependency ?? throw new ArgumentNullException(nameof(dependency));
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.5.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="PrimeFuncPack.UnitTest.Data" Version="3.1.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand Down