Remove unused variables (#1314)

* Remove unused variables

Signed-off-by: Rafael Camara <rafaelcamarac@gmail.com>
Signed-off-by: Rafael Câmara <52082556+RafaelJCamara@users.noreply.github.com>
Co-authored-by: Whit Waldo <whit.waldo@innovian.net>
This commit is contained in:
Rafael Câmara 2024-10-24 22:27:39 +02:00 committed by GitHub
parent ee8be67337
commit 94b97e224f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 94 additions and 114 deletions

View File

@ -85,7 +85,7 @@ namespace ActorClient
var nonRemotingProxy = ActorProxy.Create(actorId, "DemoActor"); var nonRemotingProxy = ActorProxy.Create(actorId, "DemoActor");
await nonRemotingProxy.InvokeMethodAsync("TestNoArgumentNoReturnType"); await nonRemotingProxy.InvokeMethodAsync("TestNoArgumentNoReturnType");
await nonRemotingProxy.InvokeMethodAsync("SaveData", data); await nonRemotingProxy.InvokeMethodAsync("SaveData", data);
var res = await nonRemotingProxy.InvokeMethodAsync<MyData>("GetData"); await nonRemotingProxy.InvokeMethodAsync<MyData>("GetData");
Console.WriteLine("Registering the timer and reminder"); Console.WriteLine("Registering the timer and reminder");
await proxy.RegisterTimer(); await proxy.RegisterTimer();

View File

@ -221,7 +221,6 @@ namespace RoutingSample
async Task ViewErrorMessage(HttpContext context) async Task ViewErrorMessage(HttpContext context)
{ {
var client = context.RequestServices.GetRequiredService<DaprClient>();
var transaction = await JsonSerializer.DeserializeAsync<Transaction>(context.Request.Body, serializerOptions); var transaction = await JsonSerializer.DeserializeAsync<Transaction>(context.Request.Body, serializerOptions);
logger.LogInformation("The amount cannot be negative: {0}", transaction.Amount); logger.LogInformation("The amount cannot be negative: {0}", transaction.Amount);

View File

@ -23,7 +23,7 @@ using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSec
var client = new ClientActorClient(proxy); var client = new ClientActorClient(proxy);
var state = await client.GetStateAsync(cancellationTokenSource.Token); await client.GetStateAsync(cancellationTokenSource.Token);
await client.SetStateAsync(new ClientState("Hello, World!"), cancellationTokenSource.Token); await client.SetStateAsync(new ClientState("Hello, World!"), cancellationTokenSource.Token);

View File

@ -64,7 +64,7 @@ namespace WorkflowUnitTest
.Returns(Task.FromResult(inventoryResult)); .Returns(Task.FromResult(inventoryResult));
// Run the workflow directly // Run the workflow directly
OrderResult result = await new OrderProcessingWorkflow().RunAsync(mockContext.Object, order); await new OrderProcessingWorkflow().RunAsync(mockContext.Object, order);
// Verify that ReserveInventoryActivity was called with a specific input // Verify that ReserveInventoryActivity was called with a specific input
mockContext.Verify( mockContext.Verify(

View File

@ -112,7 +112,6 @@ public sealed class ActorClientGenerator : ISourceGenerator
{ {
try try
{ {
var actorInterfaceTypeName = interfaceSymbol.Name;
var fullyQualifiedActorInterfaceTypeName = interfaceSymbol.ToString(); var fullyQualifiedActorInterfaceTypeName = interfaceSymbol.ToString();
var attributeData = interfaceSymbol.GetAttributes().Single(a => a.AttributeClass?.Equals(generateActorClientAttributeSymbol, SymbolEqualityComparer.Default) == true); var attributeData = interfaceSymbol.GetAttributes().Single(a => a.AttributeClass?.Equals(generateActorClientAttributeSymbol, SymbolEqualityComparer.Default) == true);

View File

@ -229,7 +229,6 @@ namespace Dapr.Actors.Runtime
// Create a Func to be invoked by common method. // Create a Func to be invoked by common method.
async Task<byte[]> RequestFunc(Actor actor, CancellationToken ct) async Task<byte[]> RequestFunc(Actor actor, CancellationToken ct)
{ {
var actorTypeName = actor.Host.ActorTypeInfo.ActorTypeName;
var actorType = actor.Host.ActorTypeInfo.ImplementationType; var actorType = actor.Host.ActorTypeInfo.ImplementationType;
var methodInfo = actor.GetMethodInfoUsingReflection(actorType, timerData.Callback); var methodInfo = actor.GetMethodInfoUsingReflection(actorType, timerData.Callback);
@ -241,7 +240,7 @@ namespace Dapr.Actors.Runtime
return default; return default;
} }
var result = await this.DispatchInternalAsync(actorId, this.timerMethodContext, RequestFunc, cancellationToken); await this.DispatchInternalAsync(actorId, this.timerMethodContext, RequestFunc, cancellationToken);
} }
internal async Task ActivateActorAsync(ActorId actorId) internal async Task ActivateActorAsync(ActorId actorId)

View File

@ -42,7 +42,7 @@ namespace Dapr.Actors.AspNetCore.IntegrationTest
// NOTE: in 3.1 TestServer.CreateClient triggers the failure, in 5.0 it's Host.Start // NOTE: in 3.1 TestServer.CreateClient triggers the failure, in 5.0 it's Host.Start
using var host = CreateHost<BadStartup>(); using var host = CreateHost<BadStartup>();
var server = host.GetTestServer(); var server = host.GetTestServer();
var client = server.CreateClient(); server.CreateClient();
}); });
Assert.Equal( Assert.Equal(

View File

@ -32,7 +32,7 @@ namespace Dapr.Actors.Test
[Fact] [Fact]
public void TestBuildActorProxyGenerator() public void TestBuildActorProxyGenerator()
{ {
ActorProxyGenerator proxyGenerator = ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor)); ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor));
} }
[Fact] [Fact]

View File

@ -115,10 +115,7 @@ namespace Dapr.Actors.Test
[InlineData(" ")] [InlineData(" ")]
public void Initialize_New_ActorId_Object_With_Null_Or_Whitespace_Id(string id) public void Initialize_New_ActorId_Object_With_Null_Or_Whitespace_Id(string id)
{ {
Assert.Throws<ArgumentException>(() => Assert.Throws<ArgumentException>(() => new ActorId(id));
{
ActorId actorId = new ActorId(id);
});
} }
[Theory] [Theory]

View File

@ -164,7 +164,7 @@ namespace Dapr.Actors.Runtime
var id = ActorId.CreateRandom(); var id = ActorId.CreateRandom();
await manager.ActivateActorAsync(id); await manager.ActivateActorAsync(id);
Assert.True(manager.TryGetActorAsync(id, out var actor)); Assert.True(manager.TryGetActorAsync(id, out _));
await Assert.ThrowsAsync<InvalidTimeZoneException>(async () => await Assert.ThrowsAsync<InvalidTimeZoneException>(async () =>
{ {

View File

@ -26,8 +26,6 @@ namespace Dapr.Actors.Test.Runtime
{ {
var actorType = typeof(TestActor); var actorType = typeof(TestActor);
var actorTypeInformation = ActorTypeInformation.Get(actorType, actorTypeName: null); var actorTypeInformation = ActorTypeInformation.Get(actorType, actorTypeName: null);
var host = ActorHost.CreateForTest<TestActor>();
var actor = new TestActor(host);
var activator = Mock.Of<ActorActivator>(); var activator = Mock.Of<ActorActivator>();

View File

@ -50,9 +50,9 @@ namespace Dapr.Actors.Serialization
{ {
var id = ActorId.CreateRandom().GetId(); var id = ActorId.CreateRandom().GetId();
var document = $@" var document = $@"
{{ {{
""actor"": ""{id}"" ""actor"": ""{id}""
}}"; }}";
var deserialized = JsonSerializer.Deserialize<ActorHolder>(document); var deserialized = JsonSerializer.Deserialize<ActorHolder>(document);
@ -62,11 +62,10 @@ namespace Dapr.Actors.Serialization
[Fact] [Fact]
public void CanDeserializeNullActorId() public void CanDeserializeNullActorId()
{ {
var id = ActorId.CreateRandom().GetId(); const string document = @"
var document = $@" {
{{ ""actor"": null
""actor"": null }";
}}";
var deserialized = JsonSerializer.Deserialize<ActorHolder>(document); var deserialized = JsonSerializer.Deserialize<ActorHolder>(document);

View File

@ -67,7 +67,6 @@ namespace Dapr.AspNetCore.IntegrationTest
using (var factory = new AppWebApplicationFactory()) using (var factory = new AppWebApplicationFactory())
{ {
var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false }); var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });
var daprClient = factory.DaprClient;
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/controllerwithoutstateentry/test"); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/controllerwithoutstateentry/test");
var response = await httpClient.SendAsync(request); var response = await httpClient.SendAsync(request);
@ -142,7 +141,6 @@ namespace Dapr.AspNetCore.IntegrationTest
using (var factory = new AppWebApplicationFactory()) using (var factory = new AppWebApplicationFactory())
{ {
var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false }); var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });
var daprClient = factory.DaprClient;
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/controllerwithstateentry/test"); var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/controllerwithstateentry/test");
var response = await httpClient.SendAsync(request); var response = await httpClient.SendAsync(request);
@ -159,7 +157,6 @@ namespace Dapr.AspNetCore.IntegrationTest
using (var factory = new AppWebApplicationFactory()) using (var factory = new AppWebApplicationFactory())
{ {
var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false }); var httpClient = factory.CreateClient(new Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryClientOptions { HandleCookies = false });
var daprClient = factory.DaprClient;
var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/echo-user?name=jimmy"); var request = new HttpRequestMessage(HttpMethod.Post, "http://localhost/echo-user?name=jimmy");
var response = await httpClient.SendAsync(request); var response = await httpClient.SendAsync(request);

View File

@ -11,7 +11,7 @@
// limitations under the License. // limitations under the License.
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
using System; using System;
using System.Text.Json; using System.Text.Json;
using Dapr.Client; using Dapr.Client;
using Grpc.Core; using Grpc.Core;
@ -44,7 +44,7 @@ namespace Dapr.AspNetCore.Test
public void DaprClientBuilder_UsesThrowOperationCanceledOnCancellation_ByDefault() public void DaprClientBuilder_UsesThrowOperationCanceledOnCancellation_ByDefault()
{ {
var builder = new DaprClientBuilder(); var builder = new DaprClientBuilder();
var daprClient = builder.Build();
Assert.True(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation); Assert.True(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation);
} }
@ -52,7 +52,7 @@ namespace Dapr.AspNetCore.Test
public void DaprClientBuilder_DoesNotOverrideUserGrpcChannelOptions() public void DaprClientBuilder_DoesNotOverrideUserGrpcChannelOptions()
{ {
var builder = new DaprClientBuilder(); var builder = new DaprClientBuilder();
var daprClient = builder.UseGrpcChannelOptions(new GrpcChannelOptions()).Build(); builder.UseGrpcChannelOptions(new GrpcChannelOptions()).Build();
Assert.False(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation); Assert.False(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation);
} }

View File

@ -35,7 +35,7 @@ namespace Dapr.Client.Test
request.Dismiss(); request.Dismiss();
// Get Request and validate // Get Request and validate
var envelope = await request.GetRequestEnvelopeAsync<Autogenerated.GetSecretRequest>(); await request.GetRequestEnvelopeAsync<Autogenerated.GetSecretRequest>();
request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues); request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues);
headerValues.Count().Should().Be(1); headerValues.Count().Should().Be(1);
@ -56,7 +56,7 @@ namespace Dapr.Client.Test
request.Dismiss(); request.Dismiss();
// Get Request and validate // Get Request and validate
var envelope = await request.GetRequestEnvelopeAsync<Autogenerated.GetSecretRequest>(); await request.GetRequestEnvelopeAsync<Autogenerated.GetSecretRequest>();
request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues); request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues);
headerValues.Should().BeNull(); headerValues.Should().BeNull();

View File

@ -88,8 +88,7 @@ namespace Dapr.Client.Test
Data = Any.Pack(data), Data = Any.Pack(data),
}; };
var response = await client.Call<InvokeResponse>()
client.Call<InvokeResponse>()
.SetResponse(invokeResponse) .SetResponse(invokeResponse)
.Build(); .Build();
@ -153,8 +152,7 @@ namespace Dapr.Client.Test
Data = Any.Pack(data), Data = Any.Pack(data),
}; };
var response = await client.Call<InvokeResponse>()
client.Call<InvokeResponse>()
.SetResponse(invokeResponse) .SetResponse(invokeResponse)
.Build(); .Build();
@ -210,8 +208,7 @@ namespace Dapr.Client.Test
Data = Any.Pack(data), Data = Any.Pack(data),
}; };
var response = await client.Call<InvokeResponse>()
client.Call<InvokeResponse>()
.SetResponse(invokeResponse) .SetResponse(invokeResponse)
.Build(); .Build();
@ -294,7 +291,7 @@ namespace Dapr.Client.Test
// Validate Response // Validate Response
var invokedResponse = await request.CompleteWithMessageAsync(response); var invokedResponse = await request.CompleteWithMessageAsync(response);
invokeResponse.Name.Should().Be(invokeResponse.Name); invokedResponse.Name.Should().Be(invokeResponse.Name);
} }
[Fact] [Fact]

View File

@ -60,7 +60,6 @@ namespace Dapr.Client.Test
string lockOwner = "owner1"; string lockOwner = "owner1";
Int32 expiryInSeconds = 0; Int32 expiryInSeconds = 0;
// Get response and validate // Get response and validate
var invokeResponse = new ArgumentException();
await Assert.ThrowsAsync<ArgumentException>(async () => await client.Lock(storeName, resourceId, lockOwner, expiryInSeconds)); await Assert.ThrowsAsync<ArgumentException>(async () => await client.Lock(storeName, resourceId, lockOwner, expiryInSeconds));
} }

View File

@ -156,7 +156,7 @@ namespace Dapr.Client
}; };
var request = new HttpRequestMessage(HttpMethod.Post, uri); var request = new HttpRequestMessage(HttpMethod.Post, uri);
var response = await CallSendAsync(handler, request); await CallSendAsync(handler, request);
Assert.Equal("https://localhost:5000/v1.0/invoke/bank/method/accounts/17?", capture.RequestUri?.OriginalString); Assert.Equal("https://localhost:5000/v1.0/invoke/bank/method/accounts/17?", capture.RequestUri?.OriginalString);
Assert.Null(capture.DaprApiToken); Assert.Null(capture.DaprApiToken);
@ -181,7 +181,7 @@ namespace Dapr.Client
}; };
var request = new HttpRequestMessage(HttpMethod.Post, uri); var request = new HttpRequestMessage(HttpMethod.Post, uri);
var response = await CallSendAsync(handler, request); await CallSendAsync(handler, request);
Assert.Equal("https://localhost:5000/v1.0/invoke/Bank/method/accounts/17?", capture.RequestUri?.OriginalString); Assert.Equal("https://localhost:5000/v1.0/invoke/Bank/method/accounts/17?", capture.RequestUri?.OriginalString);
Assert.Null(capture.DaprApiToken); Assert.Null(capture.DaprApiToken);
@ -205,7 +205,7 @@ namespace Dapr.Client
}; };
var request = new HttpRequestMessage(HttpMethod.Post, uri); var request = new HttpRequestMessage(HttpMethod.Post, uri);
var response = await CallSendAsync(handler, request); await CallSendAsync(handler, request);
Assert.Equal("https://localhost:5000/v1.0/invoke/bank/method/accounts/17?", capture.RequestUri?.OriginalString); Assert.Equal("https://localhost:5000/v1.0/invoke/bank/method/accounts/17?", capture.RequestUri?.OriginalString);
Assert.Equal("super-duper-secure", capture.DaprApiToken); Assert.Equal("super-duper-secure", capture.DaprApiToken);

View File

@ -209,7 +209,7 @@ namespace Dapr.Client.Test
return await daprClient.InvokeBindingAsync<InvokeRequest, Widget>("test", "test", new InvokeRequest() { RequestParameter = "Hello " }); return await daprClient.InvokeBindingAsync<InvokeRequest, Widget>("test", "test", new InvokeRequest() { RequestParameter = "Hello " });
}); });
var envelope = await request.GetRequestEnvelopeAsync<InvokeBindingRequest>(); await request.GetRequestEnvelopeAsync<InvokeBindingRequest>();
var ex = await Assert.ThrowsAsync<DaprException>(async () => var ex = await Assert.ThrowsAsync<DaprException>(async () =>
{ {
await request.CompleteWithMessageAsync(response); await request.CompleteWithMessageAsync(response);

View File

@ -142,7 +142,6 @@ namespace Dapr.Client.Test
request.Dismiss(); request.Dismiss();
var envelope = await request.GetRequestEnvelopeAsync<PublishEventRequest>(); var envelope = await request.GetRequestEnvelopeAsync<PublishEventRequest>();
var jsonFromRequest = envelope.Data.ToStringUtf8();
envelope.PubsubName.Should().Be(TestPubsubName); envelope.PubsubName.Should().Be(TestPubsubName);
envelope.Topic.Should().Be("test"); envelope.Topic.Should().Be("test");
@ -214,7 +213,6 @@ namespace Dapr.Client.Test
{ {
await using var client = TestClient.CreateForDaprClient(); await using var client = TestClient.CreateForDaprClient();
var publishData = new PublishData() { PublishObjectParameter = "testparam" };
var cloudEvent = new CloudEvent var cloudEvent = new CloudEvent
{ {
Source = new Uri("urn:testsource"), Source = new Uri("urn:testsource"),

View File

@ -839,8 +839,7 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>().Build();
.Build();
var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error")); var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error"));
@ -861,8 +860,8 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>()
.Build(); .Build();
var rpcException = new RpcException(new Status(StatusCode.Aborted, $"failed saving state in state store testStore")); var rpcException = new RpcException(new Status(StatusCode.Aborted, $"failed saving state in state store testStore"));
// Setup the mock client to throw an Rpc Exception with the expected details info // Setup the mock client to throw an Rpc Exception with the expected details info
@ -879,8 +878,8 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>()
.Build(); .Build();
await FluentActions.Awaiting(async () => await client.DaprClient.TrySaveStateAsync("test", "test", "testValue", null)) await FluentActions.Awaiting(async () => await client.DaprClient.TrySaveStateAsync("test", "test", "testValue", null))
.Should().ThrowAsync<ArgumentException>(); .Should().ThrowAsync<ArgumentException>();
@ -907,8 +906,8 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>()
.Build(); .Build();
var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error")); var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error"));
@ -929,8 +928,8 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>()
.Build(); .Build();
await FluentActions.Awaiting(async () => await client.DaprClient.TryDeleteStateAsync("test", "test", null)) await FluentActions.Awaiting(async () => await client.DaprClient.TryDeleteStateAsync("test", "test", null))
.Should().ThrowAsync<ArgumentException>(); .Should().ThrowAsync<ArgumentException>();
@ -957,8 +956,8 @@ namespace Dapr.Client.Test
{ {
var client = new MockClient(); var client = new MockClient();
var response = client.CallStateApi<string>() await client.CallStateApi<string>()
.Build(); .Build();
var rpcException = new RpcException(new Status(StatusCode.Aborted, $"failed deleting state with key test")); var rpcException = new RpcException(new Status(StatusCode.Aborted, $"failed deleting state with key test"));
// Setup the mock client to throw an Rpc Exception with the expected details info // Setup the mock client to throw an Rpc Exception with the expected details info

View File

@ -47,7 +47,7 @@ namespace Dapr.Client.Test
Success = true Success = true
}; };
var domainResponse = await request.CompleteWithMessageAsync(invokeResponse); await request.CompleteWithMessageAsync(invokeResponse);
//testing unlocking //testing unlocking

View File

@ -100,7 +100,7 @@ public class GeneratedClientTests
var client = new ClientActorClient(actorProxy); var client = new ClientActorClient(actorProxy);
var result = await client.GetStateAsync(cancellationTokenSource.Token); await client.GetStateAsync(cancellationTokenSource.Token);
await client.SetStateAsync(new ClientState("updated state"), cancellationTokenSource.Token); await client.SetStateAsync(new ClientState("updated state"), cancellationTokenSource.Token);
} }

View File

@ -120,7 +120,7 @@ namespace Dapr.E2E.Test
{ {
var logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger(); var logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger();
var loggerFactory = LoggerFactory.Create(builder => LoggerFactory.Create(builder =>
{ {
builder.AddSerilog(logger); builder.AddSerilog(logger);
}); });

View File

@ -25,8 +25,7 @@ namespace Dapr.E2E.Test
public async Task ActorCanProvideExceptionDetails() public async Task ActorCanProvideExceptionDetails()
{ {
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
var actorIds = new ActorId(Guid.NewGuid().ToString());
var proxy = this.ProxyFactory.CreateActorProxy<IExceptionActor>(ActorId.CreateRandom(), "ExceptionActor"); var proxy = this.ProxyFactory.CreateActorProxy<IExceptionActor>(ActorId.CreateRandom(), "ExceptionActor");
await WaitForActorRuntimeAsync(proxy, cts.Token); await WaitForActorRuntimeAsync(proxy, cts.Token);
ActorMethodInvocationException ex = await Assert.ThrowsAsync<ActorMethodInvocationException>(async () => await proxy.ExceptionExample()); ActorMethodInvocationException ex = await Assert.ThrowsAsync<ActorMethodInvocationException>(async () => await proxy.ExceptionExample());

View File

@ -41,11 +41,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentNullException>(() => var ex = Assert.Throws<ArgumentNullException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore(null, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient) .AddDaprSecretStore(null, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
.Build(); .Build();
}); });
Assert.Contains("store", ex.Message); Assert.Contains("store", ex.Message);
} }
@ -58,11 +58,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentException>(() => var ex = Assert.Throws<ArgumentException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore(string.Empty, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient) .AddDaprSecretStore(string.Empty, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
.Build(); .Build();
}); });
Assert.Contains("The value cannot be null or empty", ex.Message); Assert.Contains("The value cannot be null or empty", ex.Message);
} }
@ -75,11 +75,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentNullException>(() => var ex = Assert.Throws<ArgumentNullException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", (DaprSecretDescriptor[])null, daprClient) .AddDaprSecretStore("store", (DaprSecretDescriptor[])null, daprClient)
.Build(); .Build();
}); });
Assert.Contains("secretDescriptors", ex.Message); Assert.Contains("secretDescriptors", ex.Message);
} }
@ -88,11 +88,11 @@ namespace Dapr.Extensions.Configuration.Test
public void AddDaprSecretStore_UsingDescriptors_WithoutClient_ReportsError() public void AddDaprSecretStore_UsingDescriptors_WithoutClient_ReportsError()
{ {
var ex = Assert.Throws<ArgumentNullException>(() => var ex = Assert.Throws<ArgumentNullException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, null) .AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, null)
.Build(); .Build();
}); });
Assert.Contains("client", ex.Message); Assert.Contains("client", ex.Message);
} }
@ -105,11 +105,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentException>(() => var ex = Assert.Throws<ArgumentException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { }, daprClient) .AddDaprSecretStore("store", new DaprSecretDescriptor[] { }, daprClient)
.Build(); .Build();
}); });
Assert.Contains("No secret descriptor was provided", ex.Message); Assert.Contains("No secret descriptor was provided", ex.Message);
} }
@ -132,11 +132,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<InvalidOperationException>(() => var ex = Assert.Throws<InvalidOperationException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient) .AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
.Build(); .Build();
}); });
Assert.Contains("Please remove any duplicates from your secret store.", ex.Message); Assert.Contains("Please remove any duplicates from your secret store.", ex.Message);
} }
@ -310,7 +310,7 @@ namespace Dapr.Extensions.Configuration.Test
var ex = Assert.Throws<DaprException>(() => var ex = Assert.Throws<DaprException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore(storeName, secretDescriptors, daprClient) .AddDaprSecretStore(storeName, secretDescriptors, daprClient)
.Build(); .Build();
}); });
@ -327,11 +327,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentNullException>(() => var ex = Assert.Throws<ArgumentNullException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore(null, daprClient) .AddDaprSecretStore(null, daprClient)
.Build(); .Build();
}); });
Assert.Contains("store", ex.Message); Assert.Contains("store", ex.Message);
} }
@ -344,11 +344,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<ArgumentException>(() => var ex = Assert.Throws<ArgumentException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore(string.Empty, daprClient) .AddDaprSecretStore(string.Empty, daprClient)
.Build(); .Build();
}); });
Assert.Contains("The value cannot be null or empty", ex.Message); Assert.Contains("The value cannot be null or empty", ex.Message);
} }
@ -357,11 +357,11 @@ namespace Dapr.Extensions.Configuration.Test
public void AddDaprSecretStore_WithoutClient_ReportsError() public void AddDaprSecretStore_WithoutClient_ReportsError()
{ {
var ex = Assert.Throws<ArgumentNullException>(() => var ex = Assert.Throws<ArgumentNullException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", null) .AddDaprSecretStore("store", null)
.Build(); .Build();
}); });
Assert.Contains("client", ex.Message); Assert.Contains("client", ex.Message);
} }
@ -384,11 +384,11 @@ namespace Dapr.Extensions.Configuration.Test
.Build(); .Build();
var ex = Assert.Throws<InvalidOperationException>(() => var ex = Assert.Throws<InvalidOperationException>(() =>
{ {
var config = CreateBuilder() CreateBuilder()
.AddDaprSecretStore("store", daprClient) .AddDaprSecretStore("store", daprClient)
.Build(); .Build();
}); });
Assert.Contains("Please remove any duplicates from your secret store.", ex.Message); Assert.Contains("Please remove any duplicates from your secret store.", ex.Message);
} }