Skip to content

Commit 03c6f17

Browse files
Lorenzo Solano MartinezLorenzo Solano Martinez
authored andcommitted
Closes #31: Remove Sonar issues
1 parent 4dfc5f0 commit 03c6f17

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

src/Validations/Arguments.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static Guid NotEmptyOrExceptionWithMessage(Guid value,
176176
: value;
177177
}
178178

179-
private static bool IsEmpty(Guid value) => value == default;
179+
private static bool IsEmpty(Guid value) => value == Guid.Empty;
180180

181181
#endregion
182182

@@ -579,7 +579,7 @@ public static TNullable CompliesWith<TNullable>(
579579
[NotNull] string preconditionDescription,
580580
[NotNull, CallerArgumentExpression(nameof(value))] string paramName = "")
581581
where TNullable : class
582-
=> CompliesWithExpected(value, validator, paramName, preconditionDescription, true);
582+
=> CompliesWithExpected(value, validator, preconditionDescription, paramName, true);
583583

584584
/// <summary>
585585
/// Checks the given value for <see langword="null"/> and then if the its complies with the validator function.
@@ -597,7 +597,7 @@ public static TNullable DoesNotComplyWith<TNullable>(
597597
[NotNull] string preconditionDescription,
598598
[NotNull, CallerArgumentExpression(nameof(value))] string paramName = "")
599599
where TNullable : class
600-
=> CompliesWithExpected(value, validator, paramName, preconditionDescription, false);
600+
=> CompliesWithExpected(value, validator, preconditionDescription, paramName, false);
601601

602602
[return: NotNull]
603603
private static TNullable CompliesWithExpected<TNullable>(
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
[assembly: CLSCompliant(true)]
22
[assembly: System.Resources.NeutralResourcesLanguage("en")]
33
[assembly: System.Runtime.InteropServices.ComVisible(false)]
4-
5-
namespace Triplex.Validations.Properties;
6-
7-
/// <summary>
8-
/// Assembly information.
9-
/// </summary>
10-
public sealed class AssemblyInfo
11-
{
12-
13-
}

tests/unit/Validations.Tests/ArgumentsFacts/CompliesWithUsingLambdaMessageFacts.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public void Returns_Same_Instance()
2727
public void With_False_Throws_ArgumentException()
2828
{
2929
const string? someString = "Hello World 1234";
30-
Assert.That(() => Arguments.CompliesWith(someString, val => val.Length > 100, nameof(someString),
31-
PreconditionDescription),
30+
Assert.That(() => Arguments.CompliesWith(someString, val => val.Length > 100, PreconditionDescription,
31+
nameof(someString)),
3232
Throws.ArgumentException
3333
.With.Property(nameof(ArgumentException.ParamName)).EqualTo(nameof(someString))
3434
.And.Message.Contains(PreconditionDescription));
@@ -40,18 +40,18 @@ public void With_Invalid_ParamName_Throws_ArgumentException([Values(null, "", "
4040
{
4141
const string? someString = "Hello World 1235";
4242

43-
Assert.That(() => Arguments.CompliesWith(someString, val => precondition, paramName!, PreconditionDescription),
43+
Assert.That(() => Arguments.CompliesWith(someString, val => precondition, PreconditionDescription, paramName!),
4444
Throws.InstanceOf<ArgumentException>()
4545
.With.Property(nameof(ArgumentException.ParamName)).EqualTo("paramName"));
4646
}
4747

4848
[Test]
49-
public void With_Invalid_Description_ParamName_Throws_ArgumentException(
49+
public void With_Invalid_Description_Throws_ArgumentException(
5050
[Values(null, "", " ", "\n\r\t ")] string? description, [Values] bool precondition)
5151
{
5252
const string? someString = "Hello World 1235";
5353

54-
Assert.That(() => Arguments.CompliesWith(someString, val => precondition, nameof(someString), description!),
54+
Assert.That(() => Arguments.CompliesWith(someString, val => precondition, description!, nameof(someString)),
5555
Throws.InstanceOf<ArgumentException>()
5656
.With.Property(nameof(ArgumentException.ParamName)).EqualTo("preconditionDescription"));
5757
}

tests/unit/Validations.Tests/ArgumentsFacts/DoesNotComplyWithMessageFacts.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public void Returns_Same_Instance()
2727
public void With_True_Throws_ArgumentException()
2828
{
2929
const string? someString = "123456789";
30-
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => val.Length == 9, nameof(someString),
31-
PreconditionDescription),
30+
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => val.Length == 9, PreconditionDescription,
31+
nameof(someString)),
3232
Throws.ArgumentException
3333
.With.Property(nameof(ArgumentException.ParamName)).EqualTo(nameof(someString))
3434
.And.Message.Contains(PreconditionDescription));
@@ -40,8 +40,8 @@ public void With_Invalid_ParamName_Throws_ArgumentException([Values(null, "", "
4040
{
4141
const string? someString = "Hello World 1235";
4242

43-
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => precondition, paramName!,
44-
PreconditionDescription),
43+
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => precondition,
44+
PreconditionDescription, paramName!),
4545
Throws.InstanceOf<ArgumentException>()
4646
.With.Property(nameof(ArgumentException.ParamName)).EqualTo("paramName"));
4747
}
@@ -52,7 +52,7 @@ public void With_Invalid_Description_ParamName_Throws_ArgumentException(
5252
{
5353
const string? someString = "Hello World 1235";
5454

55-
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => precondition, nameof(someString), description!),
55+
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => precondition, description!, nameof(someString)),
5656
Throws.InstanceOf<ArgumentException>()
5757
.With.Property(nameof(ArgumentException.ParamName)).EqualTo("preconditionDescription"));
5858
}
@@ -61,8 +61,8 @@ public void With_Invalid_Description_ParamName_Throws_ArgumentException(
6161
public void With_Null_Value_Throws_ArgumentNullException()
6262
{
6363
const string? someString = null;
64-
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => val.Length > 100, nameof(someString),
65-
PreconditionDescription),
64+
Assert.That(() => Arguments.DoesNotComplyWith(someString, val => val.Length > 100,
65+
PreconditionDescription, nameof(someString)),
6666
Throws.ArgumentNullException
6767
.With.Property(nameof(ArgumentException.ParamName)).EqualTo("value")
6868
.And.Message.Contains("cannot be null"));

0 commit comments

Comments
 (0)