mirror of https://github.com/dapr/dotnet-sdk.git
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:
parent
ee8be67337
commit
94b97e224f
|
|
@ -85,7 +85,7 @@ namespace ActorClient
|
|||
var nonRemotingProxy = ActorProxy.Create(actorId, "DemoActor");
|
||||
await nonRemotingProxy.InvokeMethodAsync("TestNoArgumentNoReturnType");
|
||||
await nonRemotingProxy.InvokeMethodAsync("SaveData", data);
|
||||
var res = await nonRemotingProxy.InvokeMethodAsync<MyData>("GetData");
|
||||
await nonRemotingProxy.InvokeMethodAsync<MyData>("GetData");
|
||||
|
||||
Console.WriteLine("Registering the timer and reminder");
|
||||
await proxy.RegisterTimer();
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@ namespace RoutingSample
|
|||
|
||||
async Task ViewErrorMessage(HttpContext context)
|
||||
{
|
||||
var client = context.RequestServices.GetRequiredService<DaprClient>();
|
||||
var transaction = await JsonSerializer.DeserializeAsync<Transaction>(context.Request.Body, serializerOptions);
|
||||
|
||||
logger.LogInformation("The amount cannot be negative: {0}", transaction.Amount);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSec
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace WorkflowUnitTest
|
|||
.Returns(Task.FromResult(inventoryResult));
|
||||
|
||||
// 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
|
||||
mockContext.Verify(
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ public sealed class ActorClientGenerator : ISourceGenerator
|
|||
{
|
||||
try
|
||||
{
|
||||
var actorInterfaceTypeName = interfaceSymbol.Name;
|
||||
var fullyQualifiedActorInterfaceTypeName = interfaceSymbol.ToString();
|
||||
|
||||
var attributeData = interfaceSymbol.GetAttributes().Single(a => a.AttributeClass?.Equals(generateActorClientAttributeSymbol, SymbolEqualityComparer.Default) == true);
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ namespace Dapr.Actors.Runtime
|
|||
// Create a Func to be invoked by common method.
|
||||
async Task<byte[]> RequestFunc(Actor actor, CancellationToken ct)
|
||||
{
|
||||
var actorTypeName = actor.Host.ActorTypeInfo.ActorTypeName;
|
||||
var actorType = actor.Host.ActorTypeInfo.ImplementationType;
|
||||
var methodInfo = actor.GetMethodInfoUsingReflection(actorType, timerData.Callback);
|
||||
|
||||
|
|
@ -241,7 +240,7 @@ namespace Dapr.Actors.Runtime
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
using var host = CreateHost<BadStartup>();
|
||||
var server = host.GetTestServer();
|
||||
var client = server.CreateClient();
|
||||
server.CreateClient();
|
||||
});
|
||||
|
||||
Assert.Equal(
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ namespace Dapr.Actors.Test
|
|||
[Fact]
|
||||
public void TestBuildActorProxyGenerator()
|
||||
{
|
||||
ActorProxyGenerator proxyGenerator = ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor));
|
||||
ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -115,10 +115,7 @@ namespace Dapr.Actors.Test
|
|||
[InlineData(" ")]
|
||||
public void Initialize_New_ActorId_Object_With_Null_Or_Whitespace_Id(string id)
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
{
|
||||
ActorId actorId = new ActorId(id);
|
||||
});
|
||||
Assert.Throws<ArgumentException>(() => new ActorId(id));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace Dapr.Actors.Runtime
|
|||
|
||||
var id = ActorId.CreateRandom();
|
||||
await manager.ActivateActorAsync(id);
|
||||
Assert.True(manager.TryGetActorAsync(id, out var actor));
|
||||
Assert.True(manager.TryGetActorAsync(id, out _));
|
||||
|
||||
await Assert.ThrowsAsync<InvalidTimeZoneException>(async () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ namespace Dapr.Actors.Test.Runtime
|
|||
{
|
||||
var actorType = typeof(TestActor);
|
||||
var actorTypeInformation = ActorTypeInformation.Get(actorType, actorTypeName: null);
|
||||
var host = ActorHost.CreateForTest<TestActor>();
|
||||
var actor = new TestActor(host);
|
||||
|
||||
var activator = Mock.Of<ActorActivator>();
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ namespace Dapr.Actors.Serialization
|
|||
{
|
||||
var id = ActorId.CreateRandom().GetId();
|
||||
var document = $@"
|
||||
{{
|
||||
""actor"": ""{id}""
|
||||
}}";
|
||||
{{
|
||||
""actor"": ""{id}""
|
||||
}}";
|
||||
|
||||
var deserialized = JsonSerializer.Deserialize<ActorHolder>(document);
|
||||
|
||||
|
|
@ -62,11 +62,10 @@ namespace Dapr.Actors.Serialization
|
|||
[Fact]
|
||||
public void CanDeserializeNullActorId()
|
||||
{
|
||||
var id = ActorId.CreateRandom().GetId();
|
||||
var document = $@"
|
||||
{{
|
||||
""actor"": null
|
||||
}}";
|
||||
const string document = @"
|
||||
{
|
||||
""actor"": null
|
||||
}";
|
||||
|
||||
var deserialized = JsonSerializer.Deserialize<ActorHolder>(document);
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ namespace Dapr.AspNetCore.IntegrationTest
|
|||
using (var factory = new AppWebApplicationFactory())
|
||||
{
|
||||
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 response = await httpClient.SendAsync(request);
|
||||
|
|
@ -142,7 +141,6 @@ namespace Dapr.AspNetCore.IntegrationTest
|
|||
using (var factory = new AppWebApplicationFactory())
|
||||
{
|
||||
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 response = await httpClient.SendAsync(request);
|
||||
|
|
@ -159,7 +157,6 @@ namespace Dapr.AspNetCore.IntegrationTest
|
|||
using (var factory = new AppWebApplicationFactory())
|
||||
{
|
||||
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 response = await httpClient.SendAsync(request);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Dapr.Client;
|
||||
using Grpc.Core;
|
||||
|
|
@ -44,7 +44,7 @@ namespace Dapr.AspNetCore.Test
|
|||
public void DaprClientBuilder_UsesThrowOperationCanceledOnCancellation_ByDefault()
|
||||
{
|
||||
var builder = new DaprClientBuilder();
|
||||
var daprClient = builder.Build();
|
||||
|
||||
Assert.True(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation);
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ namespace Dapr.AspNetCore.Test
|
|||
public void DaprClientBuilder_DoesNotOverrideUserGrpcChannelOptions()
|
||||
{
|
||||
var builder = new DaprClientBuilder();
|
||||
var daprClient = builder.UseGrpcChannelOptions(new GrpcChannelOptions()).Build();
|
||||
builder.UseGrpcChannelOptions(new GrpcChannelOptions()).Build();
|
||||
Assert.False(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Dapr.Client.Test
|
|||
request.Dismiss();
|
||||
|
||||
// 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);
|
||||
headerValues.Count().Should().Be(1);
|
||||
|
|
@ -56,7 +56,7 @@ namespace Dapr.Client.Test
|
|||
request.Dismiss();
|
||||
|
||||
// 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);
|
||||
headerValues.Should().BeNull();
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@ namespace Dapr.Client.Test
|
|||
Data = Any.Pack(data),
|
||||
};
|
||||
|
||||
var response =
|
||||
client.Call<InvokeResponse>()
|
||||
await client.Call<InvokeResponse>()
|
||||
.SetResponse(invokeResponse)
|
||||
.Build();
|
||||
|
||||
|
|
@ -153,8 +152,7 @@ namespace Dapr.Client.Test
|
|||
Data = Any.Pack(data),
|
||||
};
|
||||
|
||||
var response =
|
||||
client.Call<InvokeResponse>()
|
||||
await client.Call<InvokeResponse>()
|
||||
.SetResponse(invokeResponse)
|
||||
.Build();
|
||||
|
||||
|
|
@ -210,8 +208,7 @@ namespace Dapr.Client.Test
|
|||
Data = Any.Pack(data),
|
||||
};
|
||||
|
||||
var response =
|
||||
client.Call<InvokeResponse>()
|
||||
await client.Call<InvokeResponse>()
|
||||
.SetResponse(invokeResponse)
|
||||
.Build();
|
||||
|
||||
|
|
@ -294,7 +291,7 @@ namespace Dapr.Client.Test
|
|||
|
||||
// Validate Response
|
||||
var invokedResponse = await request.CompleteWithMessageAsync(response);
|
||||
invokeResponse.Name.Should().Be(invokeResponse.Name);
|
||||
invokedResponse.Name.Should().Be(invokeResponse.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ namespace Dapr.Client.Test
|
|||
string lockOwner = "owner1";
|
||||
Int32 expiryInSeconds = 0;
|
||||
// Get response and validate
|
||||
var invokeResponse = new ArgumentException();
|
||||
await Assert.ThrowsAsync<ArgumentException>(async () => await client.Lock(storeName, resourceId, lockOwner, expiryInSeconds));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ namespace Dapr.Client
|
|||
};
|
||||
|
||||
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.Null(capture.DaprApiToken);
|
||||
|
|
@ -181,7 +181,7 @@ namespace Dapr.Client
|
|||
};
|
||||
|
||||
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.Null(capture.DaprApiToken);
|
||||
|
|
@ -205,7 +205,7 @@ namespace Dapr.Client
|
|||
};
|
||||
|
||||
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("super-duper-secure", capture.DaprApiToken);
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ namespace Dapr.Client.Test
|
|||
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 () =>
|
||||
{
|
||||
await request.CompleteWithMessageAsync(response);
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ namespace Dapr.Client.Test
|
|||
request.Dismiss();
|
||||
|
||||
var envelope = await request.GetRequestEnvelopeAsync<PublishEventRequest>();
|
||||
var jsonFromRequest = envelope.Data.ToStringUtf8();
|
||||
|
||||
envelope.PubsubName.Should().Be(TestPubsubName);
|
||||
envelope.Topic.Should().Be("test");
|
||||
|
|
@ -214,7 +213,6 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
await using var client = TestClient.CreateForDaprClient();
|
||||
|
||||
var publishData = new PublishData() { PublishObjectParameter = "testparam" };
|
||||
var cloudEvent = new CloudEvent
|
||||
{
|
||||
Source = new Uri("urn:testsource"),
|
||||
|
|
|
|||
|
|
@ -839,8 +839,7 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>().Build();
|
||||
|
||||
var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error"));
|
||||
|
||||
|
|
@ -861,8 +860,8 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>()
|
||||
.Build();
|
||||
|
||||
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
|
||||
|
|
@ -879,8 +878,8 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>()
|
||||
.Build();
|
||||
|
||||
await FluentActions.Awaiting(async () => await client.DaprClient.TrySaveStateAsync("test", "test", "testValue", null))
|
||||
.Should().ThrowAsync<ArgumentException>();
|
||||
|
|
@ -907,8 +906,8 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>()
|
||||
.Build();
|
||||
|
||||
var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error"));
|
||||
|
||||
|
|
@ -929,8 +928,8 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>()
|
||||
.Build();
|
||||
|
||||
await FluentActions.Awaiting(async () => await client.DaprClient.TryDeleteStateAsync("test", "test", null))
|
||||
.Should().ThrowAsync<ArgumentException>();
|
||||
|
|
@ -957,8 +956,8 @@ namespace Dapr.Client.Test
|
|||
{
|
||||
var client = new MockClient();
|
||||
|
||||
var response = client.CallStateApi<string>()
|
||||
.Build();
|
||||
await client.CallStateApi<string>()
|
||||
.Build();
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Dapr.Client.Test
|
|||
Success = true
|
||||
};
|
||||
|
||||
var domainResponse = await request.CompleteWithMessageAsync(invokeResponse);
|
||||
await request.CompleteWithMessageAsync(invokeResponse);
|
||||
|
||||
//testing unlocking
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class GeneratedClientTests
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace Dapr.E2E.Test
|
|||
{
|
||||
var logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger();
|
||||
|
||||
var loggerFactory = LoggerFactory.Create(builder =>
|
||||
LoggerFactory.Create(builder =>
|
||||
{
|
||||
builder.AddSerilog(logger);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ namespace Dapr.E2E.Test
|
|||
public async Task ActorCanProvideExceptionDetails()
|
||||
{
|
||||
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60));
|
||||
var actorIds = new ActorId(Guid.NewGuid().ToString());
|
||||
|
||||
|
||||
var proxy = this.ProxyFactory.CreateActorProxy<IExceptionActor>(ActorId.CreateRandom(), "ExceptionActor");
|
||||
await WaitForActorRuntimeAsync(proxy, cts.Token);
|
||||
ActorMethodInvocationException ex = await Assert.ThrowsAsync<ActorMethodInvocationException>(async () => await proxy.ExceptionExample());
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore(null, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore(null, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("store", ex.Message);
|
||||
}
|
||||
|
|
@ -58,11 +58,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore(string.Empty, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore(string.Empty, new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("The value cannot be null or empty", ex.Message);
|
||||
}
|
||||
|
|
@ -75,11 +75,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", (DaprSecretDescriptor[])null, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", (DaprSecretDescriptor[])null, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("secretDescriptors", ex.Message);
|
||||
}
|
||||
|
|
@ -88,11 +88,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
public void AddDaprSecretStore_UsingDescriptors_WithoutClient_ReportsError()
|
||||
{
|
||||
var ex = Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, null)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, null)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("client", ex.Message);
|
||||
}
|
||||
|
|
@ -105,11 +105,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("No secret descriptor was provided", ex.Message);
|
||||
}
|
||||
|
|
@ -132,11 +132,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", new DaprSecretDescriptor[] { new DaprSecretDescriptor("secretName") }, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
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 config = CreateBuilder()
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore(storeName, secretDescriptors, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
|
@ -327,11 +327,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore(null, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore(null, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("store", ex.Message);
|
||||
}
|
||||
|
|
@ -344,11 +344,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<ArgumentException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore(string.Empty, daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore(string.Empty, daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
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()
|
||||
{
|
||||
var ex = Assert.Throws<ArgumentNullException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", null)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", null)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("client", ex.Message);
|
||||
}
|
||||
|
|
@ -384,11 +384,11 @@ namespace Dapr.Extensions.Configuration.Test
|
|||
.Build();
|
||||
|
||||
var ex = Assert.Throws<InvalidOperationException>(() =>
|
||||
{
|
||||
var config = CreateBuilder()
|
||||
.AddDaprSecretStore("store", daprClient)
|
||||
.Build();
|
||||
});
|
||||
{
|
||||
CreateBuilder()
|
||||
.AddDaprSecretStore("store", daprClient)
|
||||
.Build();
|
||||
});
|
||||
|
||||
Assert.Contains("Please remove any duplicates from your secret store.", ex.Message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue