Skip to content

Commit 117dce9

Browse files
authored
Use const instead of var in test cases (#389)
1 parent 6f613bc commit 117dce9

12 files changed

+362
-273
lines changed

src/Cake.AzureDevOps.Tests/ArgumentChecksTests.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public sealed class TheNotNullExtension
1010
public void Should_Throw_If_Value_Is_Null()
1111
{
1212
// Given
13-
object value = null;
14-
var parameterName = "foo";
13+
const object value = null;
14+
const string parameterName = "foo";
1515

1616
// When
1717
var result = Record.Exception(() => value.NotNull(parameterName));
@@ -24,8 +24,8 @@ public void Should_Throw_If_Value_Is_Null()
2424
public void Should_Not_Throw_If_Value_Is_Not_Null()
2525
{
2626
// Given
27-
var value = "foo";
28-
var parameterName = "foo";
27+
const string value = "foo";
28+
const string parameterName = "foo";
2929

3030
// When
3131
value.NotNull(parameterName);
@@ -40,8 +40,8 @@ public sealed class TheNotNullOrWhiteSpaceExtension
4040
public void Should_Throw_If_Value_Is_Null()
4141
{
4242
// Given
43-
string value = null;
44-
var parameterName = "foo";
43+
const string value = null;
44+
const string parameterName = "foo";
4545

4646
// When
4747
var result = Record.Exception(() => value.NotNullOrWhiteSpace(parameterName));
@@ -55,7 +55,7 @@ public void Should_Throw_If_Value_Is_Empty()
5555
{
5656
// Given
5757
var value = string.Empty;
58-
var parameterName = "foo";
58+
const string parameterName = "foo";
5959

6060
// When
6161
var result = Record.Exception(() => value.NotNullOrWhiteSpace(parameterName));
@@ -68,8 +68,8 @@ public void Should_Throw_If_Value_Is_Empty()
6868
public void Should_Throw_If_Value_Is_WhiteSpace()
6969
{
7070
// Given
71-
var value = " ";
72-
var parameterName = "foo";
71+
const string value = " ";
72+
const string parameterName = "foo";
7373

7474
// When
7575
var result = Record.Exception(() => value.NotNullOrWhiteSpace(parameterName));
@@ -82,8 +82,8 @@ public void Should_Throw_If_Value_Is_WhiteSpace()
8282
public void Should_Not_Throw_If_Value_Is_Not_Null()
8383
{
8484
// Given
85-
var value = "foo";
86-
var parameterName = "foo";
85+
const string value = "foo";
86+
const string parameterName = "foo";
8787

8888
// When
8989
value.NotNullOrWhiteSpace(parameterName);
@@ -100,7 +100,7 @@ public sealed class TheNotNegativeOrZeroExtension
100100
public void Should_Throw_If_Value_Is_Negative(int value)
101101
{
102102
// Given
103-
var parameterName = "foo";
103+
const string parameterName = "foo";
104104

105105
// When
106106
var result = Record.Exception(() => value.NotNegativeOrZero(parameterName));
@@ -113,8 +113,8 @@ public void Should_Throw_If_Value_Is_Negative(int value)
113113
public void Should_Throw_If_Value_Is_Zero()
114114
{
115115
// Given
116-
var value = 0;
117-
var parameterName = "foo";
116+
const int value = 0;
117+
const string parameterName = "foo";
118118

119119
// When
120120
var result = Record.Exception(() => value.NotNegativeOrZero(parameterName));
@@ -129,7 +129,7 @@ public void Should_Throw_If_Value_Is_Zero()
129129
public void Should_Not_Throw_If_Value_Is_Positive(int value)
130130
{
131131
// Given
132-
var parameterName = "foo";
132+
const string parameterName = "foo";
133133

134134
// When
135135
value.NotNegativeOrZero(parameterName);

0 commit comments

Comments
 (0)