-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from pfpack/release/v2.2.0-preview.1
release/v2.2.0-preview.1
- Loading branch information
Showing
115 changed files
with
3,893 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.00.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_00_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<Task> funcAsync = null!; | ||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync()); | ||
|
||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_00_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); | ||
var funcAsync = new Func<Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(f => f.Invoke(), Times.Once); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.01.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_01_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, Task> funcAsync = null!; | ||
var arg = SomeTextStructType; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg)); | ||
|
||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
[TestCase(true)] | ||
[TestCase(false)] | ||
public async Task InvokeAsFuncAsync_01_ExpectCallFuncOnce( | ||
bool isArgNull) | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<RefType?, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<RefType?, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg = isArgNull ? null : MinusFifteenIdRefType; | ||
var actual = await funcAsync.InvokeAsFuncAsync(arg); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(f => f.Invoke(arg), Times.Once); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.02.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_02_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, RefType, Task> funcAsync = null!; | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = PlusFifteenIdRefType; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2)); | ||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_02_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<StructType, RefType?, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<StructType, RefType?, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = (RefType?)null; | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(f => f.Invoke(arg1, arg2), Times.Once); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.03.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_03_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, RefType, string, Task> funcAsync = null!; | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = PlusFifteenIdRefType; | ||
var arg3 = TabString; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3)); | ||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_03_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<StructType, RefType?, string, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<StructType, RefType?, string, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = (RefType?)null; | ||
var arg3 = TabString; | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(f => f.Invoke(arg1, arg2, arg3), Times.Once); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.04.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_04_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, RefType, string, int, Task> funcAsync = null!; | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = PlusFifteenIdRefType; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4)); | ||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_04_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<StructType, RefType?, string, int, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<StructType, RefType?, string, int, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = (RefType?)null; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(f => f.Invoke(arg1, arg2, arg3, arg4), Times.Once); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.05.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_05_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, RefType, string, int, object, Task> funcAsync = null!; | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = PlusFifteenIdRefType; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
var arg5 = new { Value = PlusTwoHundredPointFive }; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5)); | ||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_05_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<StructType, RefType?, string, int, object?, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<StructType, RefType?, string, int, object?, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = (RefType?)null; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
var arg5 = new { Value = PlusTwoHundredPointFive }; | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5), Times.Once); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.06.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using PrimeFuncPack.UnitTest; | ||
using PrimeFuncPack.UnitTest.Moq; | ||
using System; | ||
using System.Threading.Tasks; | ||
using static PrimeFuncPack.UnitTest.TestData; | ||
|
||
namespace PrimeFuncPack.Core.Tests; | ||
|
||
partial class UnitExtensionsInvokeAsyncTests | ||
{ | ||
[Test] | ||
public void InvokeAsFuncAsync_06_FuncIsNull_ExpectArgumentNullException() | ||
{ | ||
Func<StructType, RefType, string, int, object, DateTime, Task> funcAsync = null!; | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = PlusFifteenIdRefType; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
var arg5 = new { Value = PlusTwoHundredPointFive }; | ||
var arg6 = Year2015March11H01Min15; | ||
|
||
var ex = Assert.ThrowsAsync<ArgumentNullException>(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6)); | ||
Assert.AreEqual("funcAsync", ex!.ParamName); | ||
} | ||
|
||
[Test] | ||
public async Task InvokeAsFuncAsync_06_ExpectCallFuncOnce() | ||
{ | ||
var mockFuncAsync = MockFuncFactory.CreateMockFunc<StructType, RefType?, string, int, object?, DateTime, Task>(Task.CompletedTask); | ||
var funcAsync = new Func<StructType, RefType?, string, int, object?, DateTime, Task>(mockFuncAsync.Object.Invoke); | ||
|
||
var arg1 = SomeTextStructType; | ||
var arg2 = (RefType?)null; | ||
var arg3 = TabString; | ||
var arg4 = MinusFortyFive; | ||
var arg5 = new { Value = PlusTwoHundredPointFive }; | ||
var arg6 = Year2015March11H01Min15; | ||
|
||
var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6); | ||
|
||
Assert.AreEqual(Unit.Value, actual); | ||
mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6), Times.Once); | ||
} | ||
} |
Oops, something went wrong.