diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index afc3e960..f62f84a3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,7 +2,7 @@ name: .NET on: push: - branches: [ main, dev, dev/*, feature/*, fix/*, release/* ] + branches: [ main, dev, feature/*, fix/*, release/* ] pull_request: branches: [ main ] @@ -17,12 +17,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x - include-prerelease: false + dotnet-version: | + 6.0.x + 7.0.x # Create Local NuGet Source diff --git a/.gitignore b/.gitignore index 426d76dd..8a30d258 100644 --- a/.gitignore +++ b/.gitignore @@ -301,7 +301,7 @@ node_modules/ *.dsw *.dsp -# Visual Studio 6 technical files +# Visual Studio 6 technical files *.ncb *.aps diff --git a/LICENSE b/LICENSE index 36a3d9be..64bdac4b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-2022 Andrei Sergeev, Pavel Moskovoy +Copyright (c) 2020-2023 Andrei Sergeev, Pavel Moskovoy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/core-unit/Unit.Tests/Unit.Tests.csproj b/src/core-unit/Unit.Tests/Unit.Tests.csproj index 1e8a4568..234508a1 100644 --- a/src/core-unit/Unit.Tests/Unit.Tests.csproj +++ b/src/core-unit/Unit.Tests/Unit.Tests.csproj @@ -1,22 +1,22 @@ - net6.0 + net6.0;net7.0 disable enable true true false Andrei Sergeev, Pavel Moskovoy - Copyright © 2020-2022 Andrei Sergeev, Pavel Moskovoy + Copyright © 2020-2023 Andrei Sergeev, Pavel Moskovoy PrimeFuncPack.Core.Tests PrimeFuncPack.Core.Unit.Tests - - + + diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.00.cs new file mode 100644 index 00000000..9a27282d --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.00.cs @@ -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 funcAsync = null!; + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync()); + + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_00_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var actual = await funcAsync.InvokeAsFuncAsync(); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.01.cs new file mode 100644 index 00000000..4965309e --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.01.cs @@ -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 funcAsync = null!; + var arg = SomeTextStructType; + + var ex = Assert.ThrowsAsync(() => _ = 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(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.02.cs new file mode 100644 index 00000000..f1014a6e --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.02.cs @@ -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 funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_02_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.03.cs new file mode 100644 index 00000000..edc8f8f6 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.03.cs @@ -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 funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_03_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.04.cs new file mode 100644 index 00000000..afb4d816 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.04.cs @@ -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 funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_04_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.05.cs new file mode 100644 index 00000000..543a80e8 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.05.cs @@ -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 funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_05_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.06.cs new file mode 100644 index 00000000..7aedd25e --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.06.cs @@ -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 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(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_06_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.07.cs new file mode 100644 index 00000000..cc30bc9b --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.07.cs @@ -0,0 +1,49 @@ +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_07_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_07_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.08.cs new file mode 100644 index 00000000..e6661dbe --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.08.cs @@ -0,0 +1,51 @@ +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_08_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_08_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.09.cs new file mode 100644 index 00000000..18524f3d --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.09.cs @@ -0,0 +1,53 @@ +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_09_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_09_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.10.cs new file mode 100644 index 00000000..9fa48949 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.10.cs @@ -0,0 +1,55 @@ +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_10_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_10_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.11.cs new file mode 100644 index 00000000..a3b065a9 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.11.cs @@ -0,0 +1,57 @@ +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_11_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_11_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.12.cs new file mode 100644 index 00000000..26a92186 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.12.cs @@ -0,0 +1,59 @@ +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_12_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_12_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.13.cs new file mode 100644 index 00000000..58002413 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.13.cs @@ -0,0 +1,61 @@ +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_13_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_13_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.14.cs new file mode 100644 index 00000000..f85b3a66 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.14.cs @@ -0,0 +1,63 @@ +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_14_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_14_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.15.cs new file mode 100644 index 00000000..fd8c435f --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.15.cs @@ -0,0 +1,65 @@ +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_15_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_15_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.16.cs new file mode 100644 index 00000000..4035612b --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeAsFuncAsync.16.cs @@ -0,0 +1,67 @@ +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_16_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16)); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncAsync_16_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(Task.CompletedTask); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var actual = await funcAsync.InvokeAsFuncAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.00.cs similarity index 96% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.00.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.00.cs index 57c68ee4..081f14a8 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.00.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.00.cs @@ -8,6 +8,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_00_FuncIsNull_ExpectArgumentNullException() { @@ -17,6 +18,7 @@ public void InvokeThenToUnitAsync_00_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_00_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.01.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.01.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.01.cs index 3d08cb84..62dfb0c8 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.01.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.01.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_01_FuncIsNull_ExpectArgumentNullException() { @@ -21,6 +22,7 @@ public void InvokeThenToUnitAsync_01_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] [TestCase(true)] [TestCase(false)] diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.02.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.02.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.02.cs index a388a1ed..17303ebd 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.02.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.02.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_02_FuncIsNull_ExpectArgumentNullException() { @@ -22,6 +23,7 @@ public void InvokeThenToUnitAsync_02_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_02_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.03.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.03.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.03.cs index 12837d12..bb99605b 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.03.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.03.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_03_FuncIsNull_ExpectArgumentNullException() { @@ -23,6 +24,7 @@ public void InvokeThenToUnitAsync_03_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_03_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.04.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.04.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.04.cs index c8ddedc4..194ed2a1 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.04.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.04.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_04_FuncIsNull_ExpectArgumentNullException() { @@ -24,6 +25,7 @@ public void InvokeThenToUnitAsync_04_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_04_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.05.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.05.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.05.cs index 30cd8f71..41b0e82b 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.05.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.05.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_05_FuncIsNull_ExpectArgumentNullException() { @@ -25,6 +26,7 @@ public void InvokeThenToUnitAsync_05_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_05_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.06.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.06.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.06.cs index 2978e917..24a47f0a 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.06.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.06.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_06_FuncIsNull_ExpectArgumentNullException() { @@ -26,6 +27,7 @@ public void InvokeThenToUnitAsync_06_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_06_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.07.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.07.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.07.cs index 8f2714d8..6a262731 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.07.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.07.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_07_FuncIsNull_ExpectArgumentNullException() { @@ -27,6 +28,7 @@ public void InvokeThenToUnitAsync_07_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_07_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.08.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.08.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.08.cs index 40cc2568..27e2161b 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.08.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.08.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_08_FuncIsNull_ExpectArgumentNullException() { @@ -28,6 +29,7 @@ public void InvokeThenToUnitAsync_08_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_08_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.09.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.09.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.09.cs index 6fcaf3d0..810a1cc4 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.09.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.09.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_09_FuncIsNull_ExpectArgumentNullException() { @@ -29,6 +30,7 @@ public void InvokeThenToUnitAsync_09_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_09_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.10.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.10.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.10.cs index 9b2535c0..4e36a4d1 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.10.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.10.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_10_FuncIsNull_ExpectArgumentNullException() { @@ -30,6 +31,7 @@ public void InvokeThenToUnitAsync_10_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_10_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.11.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.11.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.11.cs index bb641d8c..8cd1c757 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.11.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.11.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_11_FuncIsNull_ExpectArgumentNullException() { @@ -31,6 +32,7 @@ public void InvokeThenToUnitAsync_11_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_11_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.12.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.12.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.12.cs index f2d2ac56..95231d6a 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.12.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.12.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_12_FuncIsNull_ExpectArgumentNullException() { @@ -32,6 +33,7 @@ public void InvokeThenToUnitAsync_12_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_12_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.13.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.13.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.13.cs index 93c224e0..1a6d443b 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.13.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.13.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_13_FuncIsNull_ExpectArgumentNullException() { @@ -33,6 +34,7 @@ public void InvokeThenToUnitAsync_13_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_13_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.14.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.14.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.14.cs index aa928790..5aa86174 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.14.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.14.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_14_FuncIsNull_ExpectArgumentNullException() { @@ -34,6 +35,7 @@ public void InvokeThenToUnitAsync_14_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_14_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.15.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.15.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.15.cs index 00823ba8..24940edd 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.15.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.15.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_15_FuncIsNull_ExpectArgumentNullException() { @@ -35,6 +36,7 @@ public void InvokeThenToUnitAsync_15_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_15_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.16.cs similarity index 99% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.16.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.16.cs index 659e1e8e..efb1520f 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/InvokeThenToUnitAsync.16.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeAsyncTests/Obsolete/InvokeThenToUnitAsync.16.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitAsync_16_FuncIsNull_ExpectArgumentNullException() { @@ -36,6 +37,7 @@ public void InvokeThenToUnitAsync_16_FuncIsNull_ExpectArgumentNullException() Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitAsync_16_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.00.cs new file mode 100644 index 00000000..2eb825d2 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.00.cs @@ -0,0 +1,30 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest.Moq; +using System; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_00_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + var ex = Assert.Throws(() => _ = action.InvokeAsFunc()); + + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_00_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var actual = action.InvokeAsFunc(); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.01.cs new file mode 100644 index 00000000..59483daa --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.01.cs @@ -0,0 +1,38 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_01_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + var arg = SomeTextStructType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg)); + + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void InvokeAsFunc_01_ExpectCallActionOnce( + bool isArgNull) + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg = isArgNull ? null : PlusFifteenIdRefType; + var actual = action.InvokeAsFunc(arg); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.02.cs new file mode 100644 index 00000000..d7107f9c --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.02.cs @@ -0,0 +1,38 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_02_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_02_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + + var actual = action.InvokeAsFunc(arg1, arg2); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.03.cs new file mode 100644 index 00000000..442f4346 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.03.cs @@ -0,0 +1,40 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_03_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_03_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.04.cs new file mode 100644 index 00000000..d4c7d43a --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.04.cs @@ -0,0 +1,42 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_04_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_04_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.05.cs new file mode 100644 index 00000000..30f060b9 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.05.cs @@ -0,0 +1,44 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_05_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_05_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.06.cs new file mode 100644 index 00000000..6a6a7010 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.06.cs @@ -0,0 +1,46 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_06_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_06_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.07.cs new file mode 100644 index 00000000..dd7d6817 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.07.cs @@ -0,0 +1,48 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_07_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_07_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.08.cs new file mode 100644 index 00000000..9f52eb5f --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.08.cs @@ -0,0 +1,50 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_08_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_08_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.09.cs new file mode 100644 index 00000000..a7fe36fa --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.09.cs @@ -0,0 +1,52 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_09_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_09_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.10.cs new file mode 100644 index 00000000..3709a3e1 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.10.cs @@ -0,0 +1,54 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_10_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_10_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.11.cs new file mode 100644 index 00000000..f3303c81 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.11.cs @@ -0,0 +1,56 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_11_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_11_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.12.cs new file mode 100644 index 00000000..3aef902d --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.12.cs @@ -0,0 +1,58 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_12_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_12_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.13.cs new file mode 100644 index 00000000..d4cc62e9 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.13.cs @@ -0,0 +1,60 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_13_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_13_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.14.cs new file mode 100644 index 00000000..0603a7d7 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.14.cs @@ -0,0 +1,62 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_14_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_14_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = (object?)null; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.15.cs new file mode 100644 index 00000000..f2313dfe --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.15.cs @@ -0,0 +1,64 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_15_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_15_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.16.cs new file mode 100644 index 00000000..73b2e560 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeAsFunc.16.cs @@ -0,0 +1,66 @@ +using Moq; +using NUnit.Framework; +using PrimeFuncPack.UnitTest; +using PrimeFuncPack.UnitTest.Moq; +using System; +using static PrimeFuncPack.UnitTest.TestData; + +namespace PrimeFuncPack.Core.Tests; + +partial class UnitExtensionsInvokeTests +{ + [Test] + public void InvokeAsFunc_16_ActionIsNull_ExpectArgumentNullException() + { + Action action = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var ex = Assert.Throws(() => _ = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16)); + Assert.AreEqual("action", ex!.ParamName); + } + + [Test] + public void InvokeAsFunc_16_ExpectCallActionOnce() + { + var mockAction = MockActionFactory.CreateMockAction(); + var action = new Action(mockAction.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusTwentyOne; + var arg5 = new { Value = PlusOneHundredPointFive }; + var arg6 = Year2017March25H19Min31; + var arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyOnePointThree; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = OtherTextStructType; + var arg12 = SomeOtherText; + var arg13 = PlusTwentyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var actual = action.InvokeAsFunc(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); + + Assert.AreEqual(Unit.Value, actual); + mockAction.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.00.cs similarity index 96% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.00.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.00.cs index f79c1e4a..79d6b977 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.00.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.00.cs @@ -7,6 +7,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_00_ActionIsNull_ExpectArgumentNullException() { @@ -16,6 +17,7 @@ public void InvokeThenToUnit_00_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_00_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.01.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.01.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.01.cs index c723eea7..d0cc1820 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.01.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.01.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_01_ActionIsNull_ExpectArgumentNullException() { @@ -20,6 +21,7 @@ public void InvokeThenToUnit_01_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] [TestCase(true)] [TestCase(false)] diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.02.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.02.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.02.cs index fd8bcd1d..3107ec61 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.02.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.02.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_02_ActionIsNull_ExpectArgumentNullException() { @@ -21,6 +22,7 @@ public void InvokeThenToUnit_02_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_02_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.03.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.03.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.03.cs index 95ce2a53..f3ccc83a 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.03.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.03.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_03_ActionIsNull_ExpectArgumentNullException() { @@ -22,6 +23,7 @@ public void InvokeThenToUnit_03_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_03_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.04.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.04.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.04.cs index fcbc348c..6146f544 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.04.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.04.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_04_ActionIsNull_ExpectArgumentNullException() { @@ -23,6 +24,7 @@ public void InvokeThenToUnit_04_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_04_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.05.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.05.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.05.cs index dbbbd983..90b5a943 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.05.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.05.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_05_ActionIsNull_ExpectArgumentNullException() { @@ -24,6 +25,7 @@ public void InvokeThenToUnit_05_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_05_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.06.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.06.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.06.cs index 45952cf4..4907286a 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.06.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.06.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_06_ActionIsNull_ExpectArgumentNullException() { @@ -25,6 +26,7 @@ public void InvokeThenToUnit_06_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_06_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.07.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.07.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.07.cs index 20ae195d..4d37ba79 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.07.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.07.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_07_ActionIsNull_ExpectArgumentNullException() { @@ -26,6 +27,7 @@ public void InvokeThenToUnit_07_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_07_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.08.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.08.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.08.cs index f8905fd1..e5f44d2e 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.08.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.08.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_08_ActionIsNull_ExpectArgumentNullException() { @@ -27,6 +28,7 @@ public void InvokeThenToUnit_08_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_08_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.09.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.09.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.09.cs index 2f6d9204..e48151b2 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.09.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.09.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_09_ActionIsNull_ExpectArgumentNullException() { @@ -28,6 +29,7 @@ public void InvokeThenToUnit_09_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_09_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.10.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.10.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.10.cs index 5b5ea47d..856008d5 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.10.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.10.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_10_ActionIsNull_ExpectArgumentNullException() { @@ -29,6 +30,7 @@ public void InvokeThenToUnit_10_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_10_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.11.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.11.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.11.cs index 2f9d7486..ed38c233 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.11.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.11.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_11_ActionIsNull_ExpectArgumentNullException() { @@ -30,6 +31,7 @@ public void InvokeThenToUnit_11_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_11_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.12.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.12.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.12.cs index b6b27bef..3645278d 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.12.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.12.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_12_ActionIsNull_ExpectArgumentNullException() { @@ -31,6 +32,7 @@ public void InvokeThenToUnit_12_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_12_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.13.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.13.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.13.cs index 748e1c42..ba747321 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.13.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.13.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_13_ActionIsNull_ExpectArgumentNullException() { @@ -32,6 +33,7 @@ public void InvokeThenToUnit_13_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_13_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.14.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.14.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.14.cs index 239e7b87..65e6c310 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.14.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.14.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_14_ActionIsNull_ExpectArgumentNullException() { @@ -33,6 +34,7 @@ public void InvokeThenToUnit_14_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_14_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.15.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.15.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.15.cs index 7914a775..c4d8badd 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.15.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.15.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_15_ActionIsNull_ExpectArgumentNullException() { @@ -34,6 +35,7 @@ public void InvokeThenToUnit_15_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_15_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.16.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.16.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.16.cs index 4a1ccf38..a943c1b8 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/InvokeThenToUnit.16.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeTests/Obsolete/InvokeThenToUnit.16.cs @@ -9,6 +9,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvokeTests { + [Obsolete] [Test] public void InvokeThenToUnit_16_ActionIsNull_ExpectArgumentNullException() { @@ -35,6 +36,7 @@ public void InvokeThenToUnit_16_ActionIsNull_ExpectArgumentNullException() Assert.AreEqual("action", ex!.ParamName); } + [Obsolete] [Test] public void InvokeThenToUnit_16_ExpectCallActionOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.00.cs new file mode 100644 index 00000000..8db92d4f --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.00.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_00_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync().AsTask()); + + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_00_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var actual = await funcAsync.InvokeAsFuncValueAsync(); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.01.cs new file mode 100644 index 00000000..eb87a79a --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.01.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_01_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + var arg = SomeTextStructType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg).AsTask()); + + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public async Task InvokeAsFuncValueAsync_01_ExpectCallFuncOnce( + bool isArgNull) + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var arg = isArgNull ? null : MinusFifteenIdRefType; + var actual = await funcAsync.InvokeAsFuncValueAsync(arg); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(arg), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.02.cs new file mode 100644 index 00000000..e0e39c15 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.02.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_02_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_02_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(arg1, arg2), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.03.cs new file mode 100644 index 00000000..5f449626 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.03.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_03_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_03_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(arg1, arg2, arg3), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.04.cs new file mode 100644 index 00000000..74e0f970 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.04.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_04_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_04_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(mockFuncAsync.Object.Invoke); + + var arg1 = SomeTextStructType; + var arg2 = (RefType?)null; + var arg3 = TabString; + var arg4 = MinusFortyFive; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(f => f.Invoke(arg1, arg2, arg3, arg4), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.05.cs new file mode 100644 index 00000000..14dad0a0 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.05.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_05_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_05_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.06.cs new file mode 100644 index 00000000..30ee26b4 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.06.cs @@ -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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_06_FuncIsNull_ExpectArgumentNullException() + { + Func 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(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_06_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.07.cs new file mode 100644 index 00000000..095497a4 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.07.cs @@ -0,0 +1,49 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_07_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_07_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.08.cs new file mode 100644 index 00000000..af355b1d --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.08.cs @@ -0,0 +1,51 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_08_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_08_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.09.cs new file mode 100644 index 00000000..a38fa607 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.09.cs @@ -0,0 +1,53 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_09_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_09_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.10.cs new file mode 100644 index 00000000..cd8d5ace --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.10.cs @@ -0,0 +1,55 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_10_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_10_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.11.cs new file mode 100644 index 00000000..bd38dcfd --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.11.cs @@ -0,0 +1,57 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_11_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_11_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.12.cs new file mode 100644 index 00000000..0f661bc5 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.12.cs @@ -0,0 +1,59 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_12_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_12_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.13.cs new file mode 100644 index 00000000..e52269ed --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.13.cs @@ -0,0 +1,61 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_13_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_13_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.14.cs new file mode 100644 index 00000000..4c9ff408 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.14.cs @@ -0,0 +1,63 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_14_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_14_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.15.cs new file mode 100644 index 00000000..5987df74 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.15.cs @@ -0,0 +1,65 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_15_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_15_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.16.cs new file mode 100644 index 00000000..3b67ae47 --- /dev/null +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeAsFuncValueAsync.16.cs @@ -0,0 +1,67 @@ +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 UnitExtensionsInvoketValueAsyncTests +{ + [Test] + public void InvokeAsFuncValueAsync_16_FuncIsNull_ExpectArgumentNullException() + { + Func funcAsync = null!; + + var arg1 = SomeTextStructType; + var arg2 = PlusFifteenIdRefType; + var arg3 = TabString; + var arg4 = MinusFortyFive; + var arg5 = new { Value = PlusTwoHundredPointFive }; + var arg6 = Year2015March11H01Min15; + var arg7 = NullTextStructType; + var arg8 = MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = MinusFifteenIdRefType; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var ex = Assert.ThrowsAsync(() => _ = funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16).AsTask()); + Assert.AreEqual("funcAsync", ex!.ParamName); + } + + [Test] + public async Task InvokeAsFuncValueAsync_16_ExpectCallFuncOnce() + { + var mockFuncAsync = MockFuncFactory.CreateMockFunc(default); + var funcAsync = new Func(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 arg7 = (StructType?)null; + var arg8 = (decimal?)MinusSeventyFivePointSeven; + var arg9 = ZeroIdRefType; + var arg10 = new object(); + var arg11 = CustomStringStructType; + var arg12 = CustomText; + var arg13 = PlusFortyOnePointSeventyFive; + var arg14 = (object?)null; + var arg15 = ThreeWhiteSpacesString; + var arg16 = long.MaxValue; + + var actual = await funcAsync.InvokeAsFuncValueAsync(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); + + Assert.AreEqual(Unit.Value, actual); + mockFuncAsync.Verify(a => a.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16), Times.Once); + } +} diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.00.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.00.cs similarity index 96% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.00.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.00.cs index 297bd5bb..b1a7e041 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.00.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.00.cs @@ -8,6 +8,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_00_FuncIsNull_ExpectArgumentNullException() { @@ -17,6 +18,7 @@ public void InvokeThenToUnitValueAsync_00_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_00_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.01.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.01.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.01.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.01.cs index 1c252e94..7af94fd5 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.01.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.01.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_01_FuncIsNull_ExpectArgumentNullException() { @@ -21,6 +22,7 @@ public void InvokeThenToUnitValueAsync_01_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] [TestCase(true)] [TestCase(false)] diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.02.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.02.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.02.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.02.cs index 5c020b0a..869c112a 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.02.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.02.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_02_FuncIsNull_ExpectArgumentNullException() { @@ -22,6 +23,7 @@ public void InvokeThenToUnitValueAsync_02_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_02_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.03.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.03.cs similarity index 97% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.03.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.03.cs index d4b6b5e8..17f5b7c3 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.03.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.03.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_03_FuncIsNull_ExpectArgumentNullException() { @@ -23,6 +24,7 @@ public void InvokeThenToUnitValueAsync_03_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_03_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.04.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.04.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.04.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.04.cs index 923ce3ba..d2263e30 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.04.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.04.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_04_FuncIsNull_ExpectArgumentNullException() { @@ -24,6 +25,7 @@ public void InvokeThenToUnitValueAsync_04_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_04_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.05.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.05.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.05.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.05.cs index 9489586c..b2890bae 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.05.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.05.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_05_FuncIsNull_ExpectArgumentNullException() { @@ -25,6 +26,7 @@ public void InvokeThenToUnitValueAsync_05_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_05_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.06.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.06.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.06.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.06.cs index 116d0e71..ec8a44fc 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.06.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.06.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_06_FuncIsNull_ExpectArgumentNullException() { @@ -26,6 +27,7 @@ public void InvokeThenToUnitValueAsync_06_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_06_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.07.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.07.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.07.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.07.cs index 8530e996..a2b8d2db 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.07.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.07.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_07_FuncIsNull_ExpectArgumentNullException() { @@ -27,6 +28,7 @@ public void InvokeThenToUnitValueAsync_07_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_07_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.08.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.08.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.08.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.08.cs index 0b835cc1..f4933b06 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.08.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.08.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_08_FuncIsNull_ExpectArgumentNullException() { @@ -28,6 +29,7 @@ public void InvokeThenToUnitValueAsync_08_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_08_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.09.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.09.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.09.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.09.cs index d7ffe740..8c9b1eb6 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.09.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.09.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_09_FuncIsNull_ExpectArgumentNullException() { @@ -29,6 +30,7 @@ public void InvokeThenToUnitValueAsync_09_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_09_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.10.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.10.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.10.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.10.cs index 86a0c082..613e017f 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.10.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.10.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_10_FuncIsNull_ExpectArgumentNullException() { @@ -30,6 +31,7 @@ public void InvokeThenToUnitValueAsync_10_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_10_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.11.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.11.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.11.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.11.cs index 69a6941b..dfd4042c 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.11.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.11.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_11_FuncIsNull_ExpectArgumentNullException() { @@ -31,6 +32,7 @@ public void InvokeThenToUnitValueAsync_11_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_11_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.12.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.12.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.12.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.12.cs index 68061114..e4719d0d 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.12.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.12.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_12_FuncIsNull_ExpectArgumentNullException() { @@ -32,6 +33,7 @@ public void InvokeThenToUnitValueAsync_12_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_12_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.13.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.13.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.13.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.13.cs index bada77ca..85f7d38f 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.13.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.13.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_13_FuncIsNull_ExpectArgumentNullException() { @@ -33,6 +34,7 @@ public void InvokeThenToUnitValueAsync_13_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_13_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.14.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.14.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.14.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.14.cs index 92641fb1..84d11589 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.14.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.14.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_14_FuncIsNull_ExpectArgumentNullException() { @@ -34,6 +35,7 @@ public void InvokeThenToUnitValueAsync_14_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_14_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.15.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.15.cs similarity index 98% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.15.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.15.cs index a4ff386c..8fe6152d 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.15.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.15.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_15_FuncIsNull_ExpectArgumentNullException() { @@ -35,6 +36,7 @@ public void InvokeThenToUnitValueAsync_15_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_15_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.16.cs b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.16.cs similarity index 99% rename from src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.16.cs rename to src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.16.cs index ea5792b1..a0028b21 100644 --- a/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/InvokeThenToUnitValueAsync.16.cs +++ b/src/core-unit/Unit.Tests/UnitExtensionsInvokeValueAsyncTests/Obsolete/InvokeThenToUnitValueAsync.16.cs @@ -10,6 +10,7 @@ namespace PrimeFuncPack.Core.Tests; partial class UnitExtensionsInvoketValueAsyncTests { + [Obsolete] [Test] public void InvokeThenToUnitValueAsync_16_FuncIsNull_ExpectArgumentNullException() { @@ -36,6 +37,7 @@ public void InvokeThenToUnitValueAsync_16_FuncIsNull_ExpectArgumentNullException Assert.AreEqual("funcAsync", ex!.ParamName); } + [Obsolete] [Test] public async Task InvokeThenToUnitValueAsync_16_ExpectCallFuncOnce() { diff --git a/src/core-unit/Unit/Unit.csproj b/src/core-unit/Unit/Unit.csproj index ec418746..4a6056ad 100644 --- a/src/core-unit/Unit/Unit.csproj +++ b/src/core-unit/Unit/Unit.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0;net7.0 disable enable true @@ -13,11 +13,11 @@ https://github.com/pfpack/pfpack-core-unit pfpack Andrei Sergeev, Pavel Moskovoy - Copyright © 2020-2022 Andrei Sergeev, Pavel Moskovoy + Copyright © 2020-2023 Andrei Sergeev, Pavel Moskovoy PrimeFuncPack Core.Unit is a core library for .NET consisting of Unit type targeted for use in functional programming. System PrimeFuncPack.Core.Unit - 2.1.3 + 2.2.0-preview.1 diff --git a/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnit.cs b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnit.cs new file mode 100644 index 00000000..5ab82cf9 --- /dev/null +++ b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnit.cs @@ -0,0 +1,381 @@ +namespace System; + +partial class UnitExtensions +{ + // TODO: Remove the obsoletes in v3.0 + + private const string ObsoleteMessage_InvokeThenToUnit = "This method is obsolete. Call InvokeAsFunc instead."; + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action) + => + action.InvokeAsFunc(); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T obj) + => + action.InvokeAsFunc(obj); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2) + => + action.InvokeAsFunc( + arg1, + arg2); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15); + + [Obsolete(ObsoleteMessage_InvokeThenToUnit, error: true)] + public static Unit InvokeThenToUnit( + this Action action, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15, + T16 arg16) + => + action.InvokeAsFunc( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15, + arg16); +} diff --git a/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitAsync.cs b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitAsync.cs new file mode 100644 index 00000000..8a2114b9 --- /dev/null +++ b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitAsync.cs @@ -0,0 +1,383 @@ +using System.Threading.Tasks; + +namespace System; + +partial class UnitExtensions +{ + // TODO: Remove the obsoletes in v3.0 + + private const string ObsoleteMessage_InvokeThenToUnitAsync = "This method is obsolete. Call InvokeAsFuncAsync instead."; + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync) + => + funcAsync.InvokeAsFuncAsync(); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T obj) + => + funcAsync.InvokeAsFuncAsync(obj); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitAsync, error: true)] + public static Task InvokeThenToUnitAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15, + T16 arg16) + => + funcAsync.InvokeAsFuncAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15, + arg16); +} diff --git a/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitValueAsync.cs b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitValueAsync.cs new file mode 100644 index 00000000..6bd8a396 --- /dev/null +++ b/src/core-unit/Unit/UnitExtensions.Obsolete/Obsolete.InvokeThenToUnitValueAsync.cs @@ -0,0 +1,383 @@ +using System.Threading.Tasks; + +namespace System; + +partial class UnitExtensions +{ + // TODO: Remove the obsoletes in v3.0 + + private const string ObsoleteMessage_InvokeThenToUnitValueAsync = "This method is obsolete. Call InvokeAsFuncValueAsync instead."; + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync) + => + funcAsync.InvokeAsFuncValueAsync(); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T obj) + => + funcAsync.InvokeAsFuncValueAsync(obj); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15); + + [Obsolete(ObsoleteMessage_InvokeThenToUnitValueAsync, error: true)] + public static ValueTask InvokeThenToUnitValueAsync( + this Func funcAsync, + T1 arg1, + T2 arg2, + T3 arg3, + T4 arg4, + T5 arg5, + T6 arg6, + T7 arg7, + T8 arg8, + T9 arg9, + T10 arg10, + T11 arg11, + T12 arg12, + T13 arg13, + T14 arg14, + T15 arg15, + T16 arg16) + => + funcAsync.InvokeAsFuncValueAsync( + arg1, + arg2, + arg3, + arg4, + arg5, + arg6, + arg7, + arg8, + arg9, + arg10, + arg11, + arg12, + arg13, + arg14, + arg15, + arg16); +} diff --git a/src/core-unit/Unit/Unit.Extensions/Extensions.cs b/src/core-unit/Unit/UnitExtensions/Extensions.cs similarity index 100% rename from src/core-unit/Unit/Unit.Extensions/Extensions.cs rename to src/core-unit/Unit/UnitExtensions/Extensions.cs diff --git a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnit.cs b/src/core-unit/Unit/UnitExtensions/InvokeAsFunc.cs similarity index 86% rename from src/core-unit/Unit/Unit.Extensions/InvokeThenToUnit.cs rename to src/core-unit/Unit/UnitExtensions/InvokeAsFunc.cs index 0ca9ec5b..ed3d9972 100644 --- a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnit.cs +++ b/src/core-unit/Unit/UnitExtensions/InvokeAsFunc.cs @@ -2,13 +2,13 @@ partial class UnitExtensions { - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action) => Unit.InternalInvoke( action ?? throw new ArgumentNullException(nameof(action))); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T obj) => @@ -16,7 +16,7 @@ public static Unit InvokeThenToUnit( action ?? throw new ArgumentNullException(nameof(action)), obj); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2) @@ -26,7 +26,7 @@ public static Unit InvokeThenToUnit( arg1, arg2); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -38,7 +38,7 @@ public static Unit InvokeThenToUnit( arg2, arg3); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -52,7 +52,7 @@ public static Unit InvokeThenToUnit( arg3, arg4); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -68,7 +68,7 @@ public static Unit InvokeThenToUnit( arg4, arg5); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -86,7 +86,7 @@ public static Unit InvokeThenToUnit( arg5, arg6); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -106,7 +106,7 @@ public static Unit InvokeThenToUnit( arg6, arg7); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -128,7 +128,7 @@ public static Unit InvokeThenToUnit( arg7, arg8); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -152,7 +152,7 @@ public static Unit InvokeThenToUnit( arg8, arg9); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -178,7 +178,7 @@ public static Unit InvokeThenToUnit( arg9, arg10); - public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -206,7 +206,7 @@ public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -236,7 +236,7 @@ public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -268,7 +268,7 @@ public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -302,7 +302,7 @@ public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, @@ -338,7 +338,7 @@ public static Unit InvokeThenToUnit( + public static Unit InvokeAsFunc( this Action action, T1 arg1, T2 arg2, diff --git a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitAsync.cs b/src/core-unit/Unit/UnitExtensions/InvokeAsFuncAsync.cs similarity index 84% rename from src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitAsync.cs rename to src/core-unit/Unit/UnitExtensions/InvokeAsFuncAsync.cs index fb200093..f048da3f 100644 --- a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitAsync.cs +++ b/src/core-unit/Unit/UnitExtensions/InvokeAsFuncAsync.cs @@ -4,13 +4,13 @@ namespace System; partial class UnitExtensions { - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync) => Unit.InternalInvokeAsync( funcAsync ?? throw new ArgumentNullException(nameof(funcAsync))); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T obj) => @@ -18,7 +18,7 @@ public static Task InvokeThenToUnitAsync( funcAsync ?? throw new ArgumentNullException(nameof(funcAsync)), obj); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2) @@ -28,7 +28,7 @@ public static Task InvokeThenToUnitAsync( arg1, arg2); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -40,7 +40,7 @@ public static Task InvokeThenToUnitAsync( arg2, arg3); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -54,7 +54,7 @@ public static Task InvokeThenToUnitAsync( arg3, arg4); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -70,7 +70,7 @@ public static Task InvokeThenToUnitAsync( arg4, arg5); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -88,7 +88,7 @@ public static Task InvokeThenToUnitAsync( arg5, arg6); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -108,7 +108,7 @@ public static Task InvokeThenToUnitAsync( arg6, arg7); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -130,7 +130,7 @@ public static Task InvokeThenToUnitAsync( arg7, arg8); - public static Task InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -154,7 +154,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -180,7 +180,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -208,7 +208,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -238,7 +238,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -270,7 +270,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -304,7 +304,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -340,7 +340,7 @@ public static Task InvokeThenToUnitAsync InvokeThenToUnitAsync( + public static Task InvokeAsFuncAsync( this Func funcAsync, T1 arg1, T2 arg2, diff --git a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitValueAsync.cs b/src/core-unit/Unit/UnitExtensions/InvokeAsFuncValueAsync.cs similarity index 83% rename from src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitValueAsync.cs rename to src/core-unit/Unit/UnitExtensions/InvokeAsFuncValueAsync.cs index b40733ce..df1ac230 100644 --- a/src/core-unit/Unit/Unit.Extensions/InvokeThenToUnitValueAsync.cs +++ b/src/core-unit/Unit/UnitExtensions/InvokeAsFuncValueAsync.cs @@ -4,13 +4,13 @@ namespace System; partial class UnitExtensions { - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync) => Unit.InternalInvokeValueAsync( funcAsync ?? throw new ArgumentNullException(nameof(funcAsync))); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T obj) => @@ -18,7 +18,7 @@ public static ValueTask InvokeThenToUnitValueAsync( funcAsync ?? throw new ArgumentNullException(nameof(funcAsync)), obj); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2) @@ -28,7 +28,7 @@ public static ValueTask InvokeThenToUnitValueAsync( arg1, arg2); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -40,7 +40,7 @@ public static ValueTask InvokeThenToUnitValueAsync( arg2, arg3); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -54,7 +54,7 @@ public static ValueTask InvokeThenToUnitValueAsync( arg3, arg4); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -70,7 +70,7 @@ public static ValueTask InvokeThenToUnitValueAsync( arg4, arg5); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -88,7 +88,7 @@ public static ValueTask InvokeThenToUnitValueAsync arg5, arg6); - public static ValueTask InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -108,7 +108,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -130,7 +130,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -154,7 +154,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -180,7 +180,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -208,7 +208,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -238,7 +238,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -270,7 +270,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -304,7 +304,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, @@ -340,7 +340,7 @@ public static ValueTask InvokeThenToUnitValueAsync InvokeThenToUnitValueAsync( + public static ValueTask InvokeAsFuncValueAsync( this Func funcAsync, T1 arg1, T2 arg2, diff --git a/src/core-unit/Unit/Unit.Extensions/ToUnit.cs b/src/core-unit/Unit/UnitExtensions/ToUnit.cs similarity index 100% rename from src/core-unit/Unit/Unit.Extensions/ToUnit.cs rename to src/core-unit/Unit/UnitExtensions/ToUnit.cs