/
ITestAsyncMethodWithMoqNullableParametersT6Test.cs
61 lines (58 loc) · 2.24 KB
/
ITestAsyncMethodWithMoqNullableParametersT6Test.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2019 dpvreony and Contributors. All rights reserved.
// This file is licensed to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using Moq;
using NetTestRegimentation.Moq;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace NetTestRegimentation.UnitTests.Moq
{
/// <summary>
/// Unit Tests for 6 nullable parameters through Moq.
/// </summary>
[ExcludeFromCodeCoverage]
public static class ITestAsyncMethodWithMoqNullableParametersT6Test
{
#pragma warning disable CA1034 // Nested types should not be visible
/// <inheritdoc />
public sealed class Throws : ITestAsyncMethodWithMoqNullableParameters<
FakeObject,
FakeObject,
FakeObject,
FakeObject,
FakeObject,
FakeObject>
{
/// <summary>
/// Gets the Test Data Source for the <see cref="ThrowsArgumentNullExceptionAsync"/> method.
/// </summary>
public static IEnumerable<object[]> ThrowsArgumentNullExceptionAsyncTestSource => ObjectArrayHelper.GetMoqArgObjectArrayOfArray(6);
/// <inheritdoc />
[Theory]
[MemberData(nameof(ThrowsArgumentNullExceptionAsyncTestSource))]
public async Task ThrowsArgumentNullExceptionAsync(
Mock<FakeObject> arg1,
Mock<FakeObject> arg2,
Mock<FakeObject> arg3,
Mock<FakeObject> arg4,
Mock<FakeObject> arg5,
Mock<FakeObject> arg6,
string expectedParameterNameForException)
{
var exception = await Assert.ThrowsAsync<ArgumentNullException>(() => ArgumentHelpers.ThrowIfNullAsync(
arg1?.Object,
arg2?.Object,
arg3?.Object,
arg4?.Object,
arg5?.Object,
arg6?.Object));
Assert.Equal(expectedParameterNameForException, exception.ParamName);
}
}
#pragma warning restore CA1034 // Nested types should not be visible
}
}