Fixing 502 (#503)

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
This commit is contained in:
Carlos Mendible 2021-01-05 01:50:52 +00:00 committed by GitHub
parent 776156298e
commit 9fd1900e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 1 deletions

View File

@ -42,7 +42,7 @@ namespace Dapr.Client
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("The value cannot be null or empty", nameof(name));
throw new ArgumentException("The value cannot be null or empty", name);
}
}
}

View File

@ -0,0 +1,46 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
namespace Dapr.Client.Test
{
using System;
using Xunit;
public class ArgumentVerifierTest
{
[Fact]
public void ThrowIfNull_RespectsArgumentName()
{
var ex = Assert.Throws<ArgumentNullException>(() =>
{
ArgumentVerifier.ThrowIfNull(null, "args");
});
Assert.Contains("args", ex.Message);
}
[Fact]
public void ThrowIfNullOrEmpty_RespectsArgumentName_WhenValueIsNull()
{
var ex = Assert.Throws<ArgumentNullException>(() =>
{
ArgumentVerifier.ThrowIfNullOrEmpty(null, "args");
});
Assert.Contains("args", ex.Message);
}
[Fact]
public void ThrowIfNullOrEmpty_RespectsArgumentName_WhenValueIsEmpty()
{
var ex = Assert.Throws<ArgumentException>(() =>
{
ArgumentVerifier.ThrowIfNullOrEmpty(string.Empty, "args");
});
Assert.Contains("args", ex.Message);
}
}
}