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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
<PackageReference Include="MSTest.TestAdapter" Version="3.11.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public void Test_ArrayExtensions_Jagged_GetColumn_Exception()
new int[] { 7 }
};

_ = Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
_ = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() =>
{
_ = array.GetColumn(-1).ToArray();
});

_ = Assert.ThrowsException<ArgumentOutOfRangeException>(() =>
_ = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() =>
{
_ = array.GetColumn(3).ToArray();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
<PackageReference Include="MSTest.TestAdapter" Version="3.11.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
</ItemGroup>

Expand Down
36 changes: 12 additions & 24 deletions tests/CommunityToolkit.Diagnostics.UnitTests/Test_Guard.Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ public void Test_Guard_IsEmpty_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_IsEmpty_ArrayFail()
{
Guard.IsEmpty(new int[1], nameof(Test_Guard_IsEmpty_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.IsEmpty(new int[1], nameof(Test_Guard_IsEmpty_ArrayFail)));
}

[TestMethod]
Expand All @@ -29,10 +28,9 @@ public void Test_Guard_IsNotEmpty_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_IsNotEmpty_ArrayFail()
{
Guard.IsNotEmpty(new int[0], nameof(Test_Guard_IsNotEmpty_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.IsNotEmpty(new int[0], nameof(Test_Guard_IsNotEmpty_ArrayFail)));
}

[TestMethod]
Expand All @@ -42,10 +40,9 @@ public void Test_Guard_HasSizeEqualTo_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeEqualTo_ArrayFail()
{
Guard.HasSizeEqualTo(new int[3], 4, nameof(Test_Guard_HasSizeEqualTo_ArrayOk));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeEqualTo(new int[3], 4, nameof(Test_Guard_HasSizeEqualTo_ArrayOk)));
}

[TestMethod]
Expand All @@ -55,10 +52,9 @@ public void Test_Guard_HasSizeNotEqualTo_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeNotEqualTo_ArrayFail()
{
Guard.HasSizeNotEqualTo(new int[4], 4, nameof(Test_Guard_HasSizeNotEqualTo_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeNotEqualTo(new int[4], 4, nameof(Test_Guard_HasSizeNotEqualTo_ArrayFail)));
}

[TestMethod]
Expand All @@ -68,17 +64,15 @@ public void Test_Guard_HasSizeGreaterThan_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeGreaterThan_ArrayEqualFail()
{
Guard.HasSizeGreaterThan(new int[4], 4, nameof(Test_Guard_HasSizeGreaterThan_ArrayEqualFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeGreaterThan(new int[4], 4, nameof(Test_Guard_HasSizeGreaterThan_ArrayEqualFail)));
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeGreaterThan_ArraySmallerFail()
{
Guard.HasSizeGreaterThan(new int[1], 4, nameof(Test_Guard_HasSizeGreaterThan_ArraySmallerFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeGreaterThan(new int[1], 4, nameof(Test_Guard_HasSizeGreaterThan_ArraySmallerFail)));
}

[TestMethod]
Expand All @@ -89,10 +83,9 @@ public void Test_Guard_HasSizeGreaterThanOrEqualTo_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeGreaterThanOrEqualTo_ArrayFail()
{
Guard.HasSizeGreaterThan(new int[1], 4, nameof(Test_Guard_HasSizeGreaterThanOrEqualTo_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeGreaterThan(new int[1], 4, nameof(Test_Guard_HasSizeGreaterThanOrEqualTo_ArrayFail)));
}

[TestMethod]
Expand All @@ -102,17 +95,15 @@ public void Test_Guard_HasSizeLessThan_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeLessThan_ArrayEqualFail()
{
Guard.HasSizeLessThan(new int[4], 4, nameof(Test_Guard_HasSizeLessThan_ArrayEqualFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeLessThan(new int[4], 4, nameof(Test_Guard_HasSizeLessThan_ArrayEqualFail)));
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeLessThan_ArrayGreaterFail()
{
Guard.HasSizeLessThan(new int[6], 4, nameof(Test_Guard_HasSizeLessThan_ArrayGreaterFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeLessThan(new int[6], 4, nameof(Test_Guard_HasSizeLessThan_ArrayGreaterFail)));
}

[TestMethod]
Expand All @@ -123,10 +114,9 @@ public void Test_Guard_HasSizeLessThanOrEqualTo_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeLessThanOrEqualTo_ArrayFail()
{
Guard.HasSizeLessThanOrEqualTo(new int[8], 4, nameof(Test_Guard_HasSizeLessThanOrEqualTo_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeLessThanOrEqualTo(new int[8], 4, nameof(Test_Guard_HasSizeLessThanOrEqualTo_ArrayFail)));
}

[TestMethod]
Expand All @@ -136,10 +126,9 @@ public void Test_Guard_HasSizeEqualToArray_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeEqualToArray_ArrayFail()
{
Guard.HasSizeEqualTo(new int[8], new int[2], nameof(Test_Guard_HasSizeEqualToArray_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeEqualTo(new int[8], new int[2], nameof(Test_Guard_HasSizeEqualToArray_ArrayFail)));
}

[TestMethod]
Expand All @@ -150,9 +139,8 @@ public void Test_Guard_HasSizeLessThanOrEqualToArray_ArrayOk()
}

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void Test_Guard_HasSizeLessThanOrEqualToArray_ArrayFail()
{
Guard.HasSizeLessThanOrEqualTo(new int[8], new int[2], nameof(Test_Guard_HasSizeLessThanOrEqualToArray_ArrayFail));
_ = Assert.ThrowsExactly<ArgumentException>(() => Guard.HasSizeLessThanOrEqualTo(new int[8], new int[2], nameof(Test_Guard_HasSizeLessThanOrEqualToArray_ArrayFail)));
}
}
Loading