mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-16 22:39:29 +00:00
0a30872781
* Introduce .netcore extensions Implement ArgumentNullException for .net6 and c#10 * Update pipelines to install .netcore 6 * Update test projects to .net 6.0
43 lines
950 B
C#
43 lines
950 B
C#
using FluentAssertions;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace System.Extensions.Tests;
|
|
|
|
[TestClass]
|
|
public class ObjectExtensionsTests
|
|
{
|
|
[TestMethod]
|
|
public void ThrowIfNull_NetCore_ThrowsWithCorrectName()
|
|
{
|
|
object obj = null;
|
|
try
|
|
{
|
|
System.Core.Extensions.ObjectExtensions.ThrowIfNull(obj);
|
|
}
|
|
catch (ArgumentNullException ex)
|
|
{
|
|
ex.ParamName.Should().Be("obj");
|
|
return;
|
|
}
|
|
|
|
Assert.Fail("Null object should throw");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ThrowIfNull_NetStandard_ThrowsWithCorrectName()
|
|
{
|
|
object obj = null;
|
|
try
|
|
{
|
|
ObjectExtensions.ThrowIfNull(obj, nameof(obj));
|
|
}
|
|
catch (ArgumentNullException ex)
|
|
{
|
|
ex.ParamName.Should().Be("obj");
|
|
return;
|
|
}
|
|
|
|
Assert.Fail("Null object should throw");
|
|
}
|
|
}
|