Skip to content

Commit 69b2256

Browse files
committed
Add tests for Requires.NotNull
1 parent 70e9c76 commit 69b2256

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
2+
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
3+
4+
namespace StyleCop.Analyzers.Test.HelperTests
5+
{
6+
using System;
7+
using StyleCop.Analyzers.Helpers;
8+
using Xunit;
9+
10+
public class RequiresTests
11+
{
12+
[Fact]
13+
public void TestNotNull()
14+
{
15+
string parameterName = nameof(parameterName);
16+
Requires.NotNull(string.Empty, parameterName);
17+
}
18+
19+
[Fact]
20+
public void TestNull()
21+
{
22+
string parameterName = nameof(parameterName);
23+
Assert.Throws<ArgumentNullException>(parameterName, () => Requires.NotNull(default(string), parameterName));
24+
}
25+
}
26+
}

StyleCop.Analyzers/StyleCop.Analyzers.Test/StyleCop.Analyzers.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
<Compile Include="Helpers\UseCultureAttribute.cs" />
180180
<Compile Include="HelperTests\AccessLevelHelperTests.cs" />
181181
<Compile Include="HelperTests\IndentationHelperTests.cs" />
182+
<Compile Include="HelperTests\RequiresTests.cs" />
182183
<Compile Include="HelperTests\TokenHelperTests.cs" />
183184
<Compile Include="HelperTests\TriviaHelperTests.cs" />
184185
<Compile Include="HelperTests\XmlSyntaxFactoryTests.cs" />

0 commit comments

Comments
 (0)