From 94b97e224f92ab4d4667390a00ef00d5c61d6747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A2mara?= <52082556+RafaelJCamara@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:27:39 +0200 Subject: [PATCH] Remove unused variables (#1314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove unused variables Signed-off-by: Rafael Camara Signed-off-by: Rafael Câmara <52082556+RafaelJCamara@users.noreply.github.com> Co-authored-by: Whit Waldo --- examples/Actor/ActorClient/Program.cs | 2 +- examples/AspNetCore/RoutingSample/Startup.cs | 1 - .../GeneratedActor/ActorClient/Program.cs | 2 +- .../WorkflowUnitTest/OrderProcessingTests.cs | 2 +- .../ActorClientGenerator.cs | 1 - src/Dapr.Actors/Runtime/ActorManager.cs | 3 +- .../HostingTests.cs | 2 +- .../Dapr.Actors.Test/ActorCodeBuilderTests.cs | 2 +- test/Dapr.Actors.Test/ActorIdTests.cs | 5 +- .../Runtime/ActorManagerTests.cs | 2 +- .../Runtime/ActorRuntimeOptionsTests.cs | 2 - .../Serialization/ActorIdJsonConverterTest.cs | 15 ++- .../ControllerIntegrationTest.cs | 3 - .../DaprClientBuilderTest.cs | 6 +- test/Dapr.Client.Test/DaprApiTokenTest.cs | 4 +- .../DaprClientTest.InvokeMethodGrpcAsync.cs | 11 +- .../DistributedLockApiTest.cs | 1 - .../InvocationHandlerTests.cs | 6 +- test/Dapr.Client.Test/InvokeBindingApiTest.cs | 2 +- test/Dapr.Client.Test/PublishEventApiTest.cs | 2 - test/Dapr.Client.Test/StateApiTest.cs | 23 ++-- test/Dapr.Client.Test/TryLockResponseTest.cs | 2 +- .../Clients/GeneratedClientTests.cs | 2 +- test/Dapr.E2E.Test.App/Startup.cs | 2 +- .../Actors/E2ETests.ExceptionTests.cs | 3 +- ...aprSecretStoreConfigurationProviderTest.cs | 102 +++++++++--------- 26 files changed, 94 insertions(+), 114 deletions(-) diff --git a/examples/Actor/ActorClient/Program.cs b/examples/Actor/ActorClient/Program.cs index f6ca26f53..950869b2b 100644 --- a/examples/Actor/ActorClient/Program.cs +++ b/examples/Actor/ActorClient/Program.cs @@ -85,7 +85,7 @@ public static async Task Main(string[] args) var nonRemotingProxy = ActorProxy.Create(actorId, "DemoActor"); await nonRemotingProxy.InvokeMethodAsync("TestNoArgumentNoReturnType"); await nonRemotingProxy.InvokeMethodAsync("SaveData", data); - var res = await nonRemotingProxy.InvokeMethodAsync("GetData"); + await nonRemotingProxy.InvokeMethodAsync("GetData"); Console.WriteLine("Registering the timer and reminder"); await proxy.RegisterTimer(); diff --git a/examples/AspNetCore/RoutingSample/Startup.cs b/examples/AspNetCore/RoutingSample/Startup.cs index 29bb488fe..3d71e9e1f 100644 --- a/examples/AspNetCore/RoutingSample/Startup.cs +++ b/examples/AspNetCore/RoutingSample/Startup.cs @@ -221,7 +221,6 @@ await JsonSerializer.SerializeAsync(context.Response.Body, async Task ViewErrorMessage(HttpContext context) { - var client = context.RequestServices.GetRequiredService(); var transaction = await JsonSerializer.DeserializeAsync(context.Request.Body, serializerOptions); logger.LogInformation("The amount cannot be negative: {0}", transaction.Amount); diff --git a/examples/GeneratedActor/ActorClient/Program.cs b/examples/GeneratedActor/ActorClient/Program.cs index 87f714907..0b858214a 100644 --- a/examples/GeneratedActor/ActorClient/Program.cs +++ b/examples/GeneratedActor/ActorClient/Program.cs @@ -23,7 +23,7 @@ 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); diff --git a/examples/Workflow/WorkflowUnitTest/OrderProcessingTests.cs b/examples/Workflow/WorkflowUnitTest/OrderProcessingTests.cs index e38a0c940..3093e5c7a 100644 --- a/examples/Workflow/WorkflowUnitTest/OrderProcessingTests.cs +++ b/examples/Workflow/WorkflowUnitTest/OrderProcessingTests.cs @@ -64,7 +64,7 @@ public async Task TestInsufficientInventory() .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( diff --git a/src/Dapr.Actors.Generators/ActorClientGenerator.cs b/src/Dapr.Actors.Generators/ActorClientGenerator.cs index 349d80188..f95fc4224 100644 --- a/src/Dapr.Actors.Generators/ActorClientGenerator.cs +++ b/src/Dapr.Actors.Generators/ActorClientGenerator.cs @@ -112,7 +112,6 @@ public void Execute(GeneratorExecutionContext context) { try { - var actorInterfaceTypeName = interfaceSymbol.Name; var fullyQualifiedActorInterfaceTypeName = interfaceSymbol.ToString(); var attributeData = interfaceSymbol.GetAttributes().Single(a => a.AttributeClass?.Equals(generateActorClientAttributeSymbol, SymbolEqualityComparer.Default) == true); diff --git a/src/Dapr.Actors/Runtime/ActorManager.cs b/src/Dapr.Actors/Runtime/ActorManager.cs index 80049d65f..a641440cf 100644 --- a/src/Dapr.Actors/Runtime/ActorManager.cs +++ b/src/Dapr.Actors/Runtime/ActorManager.cs @@ -229,7 +229,6 @@ internal async Task FireTimerAsync(ActorId actorId, Stream requestBodyStream, Ca // Create a Func to be invoked by common method. async Task 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 @@ async Task RequestFunc(Actor actor, CancellationToken ct) 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) diff --git a/test/Dapr.Actors.AspNetCore.IntegrationTest/HostingTests.cs b/test/Dapr.Actors.AspNetCore.IntegrationTest/HostingTests.cs index 7f96c66e6..bf3757ce1 100644 --- a/test/Dapr.Actors.AspNetCore.IntegrationTest/HostingTests.cs +++ b/test/Dapr.Actors.AspNetCore.IntegrationTest/HostingTests.cs @@ -42,7 +42,7 @@ public void MapActorsHandlers_WithoutAddActors_Throws() // NOTE: in 3.1 TestServer.CreateClient triggers the failure, in 5.0 it's Host.Start using var host = CreateHost(); var server = host.GetTestServer(); - var client = server.CreateClient(); + server.CreateClient(); }); Assert.Equal( diff --git a/test/Dapr.Actors.Test/ActorCodeBuilderTests.cs b/test/Dapr.Actors.Test/ActorCodeBuilderTests.cs index 6bb3c827d..1b4a3fb26 100644 --- a/test/Dapr.Actors.Test/ActorCodeBuilderTests.cs +++ b/test/Dapr.Actors.Test/ActorCodeBuilderTests.cs @@ -32,7 +32,7 @@ public class ActorCodeBuilderTests [Fact] public void TestBuildActorProxyGenerator() { - ActorProxyGenerator proxyGenerator = ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor)); + ActorCodeBuilder.GetOrCreateProxyGenerator(typeof(ITestActor)); } [Fact] diff --git a/test/Dapr.Actors.Test/ActorIdTests.cs b/test/Dapr.Actors.Test/ActorIdTests.cs index 668bd0fbf..c54f4c351 100644 --- a/test/Dapr.Actors.Test/ActorIdTests.cs +++ b/test/Dapr.Actors.Test/ActorIdTests.cs @@ -115,10 +115,7 @@ public class ActorIdTests [InlineData(" ")] public void Initialize_New_ActorId_Object_With_Null_Or_Whitespace_Id(string id) { - Assert.Throws(() => - { - ActorId actorId = new ActorId(id); - }); + Assert.Throws(() => new ActorId(id)); } [Theory] diff --git a/test/Dapr.Actors.Test/Runtime/ActorManagerTests.cs b/test/Dapr.Actors.Test/Runtime/ActorManagerTests.cs index 6b92c7e18..b27e9afe3 100644 --- a/test/Dapr.Actors.Test/Runtime/ActorManagerTests.cs +++ b/test/Dapr.Actors.Test/Runtime/ActorManagerTests.cs @@ -164,7 +164,7 @@ public async Task DeactivateActorAsync_ExceptionDuringDeactivation_ActorIsRemove 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(async () => { diff --git a/test/Dapr.Actors.Test/Runtime/ActorRuntimeOptionsTests.cs b/test/Dapr.Actors.Test/Runtime/ActorRuntimeOptionsTests.cs index 4fe991970..b68eda5ce 100644 --- a/test/Dapr.Actors.Test/Runtime/ActorRuntimeOptionsTests.cs +++ b/test/Dapr.Actors.Test/Runtime/ActorRuntimeOptionsTests.cs @@ -26,8 +26,6 @@ public void TestRegisterActor_SavesActivator() { var actorType = typeof(TestActor); var actorTypeInformation = ActorTypeInformation.Get(actorType, actorTypeName: null); - var host = ActorHost.CreateForTest(); - var actor = new TestActor(host); var activator = Mock.Of(); diff --git a/test/Dapr.Actors.Test/Serialization/ActorIdJsonConverterTest.cs b/test/Dapr.Actors.Test/Serialization/ActorIdJsonConverterTest.cs index fe33eca54..9c4f22193 100644 --- a/test/Dapr.Actors.Test/Serialization/ActorIdJsonConverterTest.cs +++ b/test/Dapr.Actors.Test/Serialization/ActorIdJsonConverterTest.cs @@ -50,9 +50,9 @@ public void CanDeserializeActorId() { var id = ActorId.CreateRandom().GetId(); var document = $@" -{{ - ""actor"": ""{id}"" -}}"; + {{ + ""actor"": ""{id}"" + }}"; var deserialized = JsonSerializer.Deserialize(document); @@ -62,11 +62,10 @@ public void CanDeserializeActorId() [Fact] public void CanDeserializeNullActorId() { - var id = ActorId.CreateRandom().GetId(); - var document = $@" -{{ - ""actor"": null -}}"; + const string document = @" + { + ""actor"": null + }"; var deserialized = JsonSerializer.Deserialize(document); diff --git a/test/Dapr.AspNetCore.IntegrationTest/ControllerIntegrationTest.cs b/test/Dapr.AspNetCore.IntegrationTest/ControllerIntegrationTest.cs index 364cd8448..7735ec4fb 100644 --- a/test/Dapr.AspNetCore.IntegrationTest/ControllerIntegrationTest.cs +++ b/test/Dapr.AspNetCore.IntegrationTest/ControllerIntegrationTest.cs @@ -67,7 +67,6 @@ public async Task ModelBinder_GetFromStateEntryWithKeyNotInStateStore_ReturnsNul 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 @@ public async Task ModelBinder_GetFromStateEntryWithStateEntry_WithKeyNotInStateS 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 @@ public async Task ModelBinder_CanGetOutOfTheWayWhenTheresNoBinding() 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); diff --git a/test/Dapr.AspNetCore.Test/DaprClientBuilderTest.cs b/test/Dapr.AspNetCore.Test/DaprClientBuilderTest.cs index 52d0b7000..bd807ebae 100644 --- a/test/Dapr.AspNetCore.Test/DaprClientBuilderTest.cs +++ b/test/Dapr.AspNetCore.Test/DaprClientBuilderTest.cs @@ -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 @@ public void DaprClientBuilder_UsesPropertyNameCaseHandlingAsSpecified() public void DaprClientBuilder_UsesThrowOperationCanceledOnCancellation_ByDefault() { var builder = new DaprClientBuilder(); - var daprClient = builder.Build(); + Assert.True(builder.GrpcChannelOptions.ThrowOperationCanceledOnCancellation); } @@ -52,7 +52,7 @@ public void DaprClientBuilder_UsesThrowOperationCanceledOnCancellation_ByDefault 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); } diff --git a/test/Dapr.Client.Test/DaprApiTokenTest.cs b/test/Dapr.Client.Test/DaprApiTokenTest.cs index 3726e0321..cf9f422bc 100644 --- a/test/Dapr.Client.Test/DaprApiTokenTest.cs +++ b/test/Dapr.Client.Test/DaprApiTokenTest.cs @@ -35,7 +35,7 @@ public async Task DaprCall_WithApiTokenSet() request.Dismiss(); // Get Request and validate - var envelope = await request.GetRequestEnvelopeAsync(); + await request.GetRequestEnvelopeAsync(); request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues); headerValues.Count().Should().Be(1); @@ -56,7 +56,7 @@ public async Task DaprCall_WithoutApiToken() request.Dismiss(); // Get Request and validate - var envelope = await request.GetRequestEnvelopeAsync(); + await request.GetRequestEnvelopeAsync(); request.Request.Headers.TryGetValues("dapr-api-token", out var headerValues); headerValues.Should().BeNull(); diff --git a/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs b/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs index 65b9b1e7d..6ccbbe4c4 100644 --- a/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs +++ b/test/Dapr.Client.Test/DaprClientTest.InvokeMethodGrpcAsync.cs @@ -88,8 +88,7 @@ public async Task InvokeMethodGrpcAsync_CanInvokeMethodWithReturnTypeAndData_Thr Data = Any.Pack(data), }; - var response = - client.Call() + await client.Call() .SetResponse(invokeResponse) .Build(); @@ -153,8 +152,7 @@ public async Task InvokeMethodGrpcAsync_CanInvokeMethodWithReturnTypeNoData_Thro Data = Any.Pack(data), }; - var response = - client.Call() + await client.Call() .SetResponse(invokeResponse) .Build(); @@ -210,8 +208,7 @@ public async Task InvokeMethodGrpcAsync_CanInvokeMethodWithNoReturnTypeAndData_T Data = Any.Pack(data), }; - var response = - client.Call() + await client.Call() .SetResponse(invokeResponse) .Build(); @@ -294,7 +291,7 @@ public async Task InvokeMethodGrpcAsync_WithReturnTypeAndData() // Validate Response var invokedResponse = await request.CompleteWithMessageAsync(response); - invokeResponse.Name.Should().Be(invokeResponse.Name); + invokedResponse.Name.Should().Be(invokeResponse.Name); } [Fact] diff --git a/test/Dapr.Client.Test/DistributedLockApiTest.cs b/test/Dapr.Client.Test/DistributedLockApiTest.cs index def7d8f8f..a030586c5 100644 --- a/test/Dapr.Client.Test/DistributedLockApiTest.cs +++ b/test/Dapr.Client.Test/DistributedLockApiTest.cs @@ -60,7 +60,6 @@ public async Task TryLockAsync_WithAllValues_ArgumentVerifierException() string lockOwner = "owner1"; Int32 expiryInSeconds = 0; // Get response and validate - var invokeResponse = new ArgumentException(); await Assert.ThrowsAsync(async () => await client.Lock(storeName, resourceId, lockOwner, expiryInSeconds)); } diff --git a/test/Dapr.Client.Test/InvocationHandlerTests.cs b/test/Dapr.Client.Test/InvocationHandlerTests.cs index 3dac84113..b171ca399 100644 --- a/test/Dapr.Client.Test/InvocationHandlerTests.cs +++ b/test/Dapr.Client.Test/InvocationHandlerTests.cs @@ -156,7 +156,7 @@ public async Task SendAsync_RewritesUri() }; 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 @@ public async Task SendAsync_RewritesUri_AndAppId() }; 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 @@ public async Task SendAsync_RewritesUri_AndAddsApiToken() }; 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); diff --git a/test/Dapr.Client.Test/InvokeBindingApiTest.cs b/test/Dapr.Client.Test/InvokeBindingApiTest.cs index 30c9d48ba..c2ada7a11 100644 --- a/test/Dapr.Client.Test/InvokeBindingApiTest.cs +++ b/test/Dapr.Client.Test/InvokeBindingApiTest.cs @@ -209,7 +209,7 @@ public async Task InvokeBindingAsync_WrapsJsonException() return await daprClient.InvokeBindingAsync("test", "test", new InvokeRequest() { RequestParameter = "Hello " }); }); - var envelope = await request.GetRequestEnvelopeAsync(); + await request.GetRequestEnvelopeAsync(); var ex = await Assert.ThrowsAsync(async () => { await request.CompleteWithMessageAsync(response); diff --git a/test/Dapr.Client.Test/PublishEventApiTest.cs b/test/Dapr.Client.Test/PublishEventApiTest.cs index 77d6ee905..e3e21dd2b 100644 --- a/test/Dapr.Client.Test/PublishEventApiTest.cs +++ b/test/Dapr.Client.Test/PublishEventApiTest.cs @@ -142,7 +142,6 @@ public async Task PublishEventAsync_CanPublishTopicWithNoContent() request.Dismiss(); var envelope = await request.GetRequestEnvelopeAsync(); - var jsonFromRequest = envelope.Data.ToStringUtf8(); envelope.PubsubName.Should().Be(TestPubsubName); envelope.Topic.Should().Be("test"); @@ -214,7 +213,6 @@ public async Task PublishEventAsync_CanPublishCloudEventWithNoContent() { await using var client = TestClient.CreateForDaprClient(); - var publishData = new PublishData() { PublishObjectParameter = "testparam" }; var cloudEvent = new CloudEvent { Source = new Uri("urn:testsource"), diff --git a/test/Dapr.Client.Test/StateApiTest.cs b/test/Dapr.Client.Test/StateApiTest.cs index 0684a8db0..b240605a1 100644 --- a/test/Dapr.Client.Test/StateApiTest.cs +++ b/test/Dapr.Client.Test/StateApiTest.cs @@ -839,8 +839,7 @@ public async Task TrySaveStateAsync_ValidateNonETagErrorThrowsException() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi().Build(); var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error")); @@ -861,8 +860,8 @@ public async Task TrySaveStateAsync_ValidateETagRelatedExceptionReturnsFalse() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi() + .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 @@ public async Task TrySaveStateAsync_NullEtagThrowsArgumentException() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi() + .Build(); await FluentActions.Awaiting(async () => await client.DaprClient.TrySaveStateAsync("test", "test", "testValue", null)) .Should().ThrowAsync(); @@ -907,8 +906,8 @@ public async Task TryDeleteStateAsync_ValidateNonETagErrorThrowsException() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi() + .Build(); var rpcException = new RpcException(new Status(StatusCode.Internal, "Network Error")); @@ -929,8 +928,8 @@ public async Task TryDeleteStateAsync_NullEtagThrowsArgumentException() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi() + .Build(); await FluentActions.Awaiting(async () => await client.DaprClient.TryDeleteStateAsync("test", "test", null)) .Should().ThrowAsync(); @@ -957,8 +956,8 @@ public async Task TryDeleteStateAsync_ValidateETagRelatedExceptionReturnsFalse() { var client = new MockClient(); - var response = client.CallStateApi() - .Build(); + await client.CallStateApi() + .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 diff --git a/test/Dapr.Client.Test/TryLockResponseTest.cs b/test/Dapr.Client.Test/TryLockResponseTest.cs index f94f949db..3420dc233 100644 --- a/test/Dapr.Client.Test/TryLockResponseTest.cs +++ b/test/Dapr.Client.Test/TryLockResponseTest.cs @@ -47,7 +47,7 @@ public async Task TryLockAsync_WithAllValues_ValidateRequest() Success = true }; - var domainResponse = await request.CompleteWithMessageAsync(invokeResponse); + await request.CompleteWithMessageAsync(invokeResponse); //testing unlocking diff --git a/test/Dapr.E2E.Test.Actors.Generators/Clients/GeneratedClientTests.cs b/test/Dapr.E2E.Test.Actors.Generators/Clients/GeneratedClientTests.cs index 6079b5df7..a089a2e82 100644 --- a/test/Dapr.E2E.Test.Actors.Generators/Clients/GeneratedClientTests.cs +++ b/test/Dapr.E2E.Test.Actors.Generators/Clients/GeneratedClientTests.cs @@ -100,7 +100,7 @@ public async Task TestGeneratedClientAsync() 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); } diff --git a/test/Dapr.E2E.Test.App/Startup.cs b/test/Dapr.E2E.Test.App/Startup.cs index bfca60f91..7e7484d54 100644 --- a/test/Dapr.E2E.Test.App/Startup.cs +++ b/test/Dapr.E2E.Test.App/Startup.cs @@ -120,7 +120,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { var logger = new LoggerConfiguration().WriteTo.File("log.txt").CreateLogger(); - var loggerFactory = LoggerFactory.Create(builder => + LoggerFactory.Create(builder => { builder.AddSerilog(logger); }); diff --git a/test/Dapr.E2E.Test/Actors/E2ETests.ExceptionTests.cs b/test/Dapr.E2E.Test/Actors/E2ETests.ExceptionTests.cs index 986a2c4f0..fc036d15d 100644 --- a/test/Dapr.E2E.Test/Actors/E2ETests.ExceptionTests.cs +++ b/test/Dapr.E2E.Test/Actors/E2ETests.ExceptionTests.cs @@ -25,8 +25,7 @@ public partial class E2ETests : IAsyncLifetime public async Task ActorCanProvideExceptionDetails() { using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(60)); - var actorIds = new ActorId(Guid.NewGuid().ToString()); - + var proxy = this.ProxyFactory.CreateActorProxy(ActorId.CreateRandom(), "ExceptionActor"); await WaitForActorRuntimeAsync(proxy, cts.Token); ActorMethodInvocationException ex = await Assert.ThrowsAsync(async () => await proxy.ExceptionExample()); diff --git a/test/Dapr.Extensions.Configuration.Test/DaprSecretStoreConfigurationProviderTest.cs b/test/Dapr.Extensions.Configuration.Test/DaprSecretStoreConfigurationProviderTest.cs index 74b66c3cb..fd323f989 100644 --- a/test/Dapr.Extensions.Configuration.Test/DaprSecretStoreConfigurationProviderTest.cs +++ b/test/Dapr.Extensions.Configuration.Test/DaprSecretStoreConfigurationProviderTest.cs @@ -41,11 +41,11 @@ public void AddDaprSecretStore_UsingDescriptors_WithoutStore_ReportsError() .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_UsingDescriptors_WithEmptyStore_ReportsError() .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_UsingDescriptors_WithoutSecretDescriptors_Reports .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_UsingDescriptors_WithoutSecretDescriptors_Reports public void AddDaprSecretStore_UsingDescriptors_WithoutClient_ReportsError() { var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_UsingDescriptors_WithZeroSecretDescriptors_Report .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_UsingDescriptors_DuplicateSecret_ReportsError() .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void LoadSecrets_FromSecretStoreRequiredAndDoesNotExist_ShouldThrowExcept var ex = Assert.Throws(() => { - var config = CreateBuilder() + CreateBuilder() .AddDaprSecretStore(storeName, secretDescriptors, daprClient) .Build(); }); @@ -327,11 +327,11 @@ public void AddDaprSecretStore_WithoutStore_ReportsError() .Build(); var ex = Assert.Throws(() => - { - var config = CreateBuilder() - .AddDaprSecretStore(null, daprClient) - .Build(); - }); + { + CreateBuilder() + .AddDaprSecretStore(null, daprClient) + .Build(); + }); Assert.Contains("store", ex.Message); } @@ -344,11 +344,11 @@ public void AddDaprSecretStore_WithEmptyStore_ReportsError() .Build(); var ex = Assert.Throws(() => - { - 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 @@ public void AddDaprSecretStore_WithEmptyStore_ReportsError() public void AddDaprSecretStore_WithoutClient_ReportsError() { var ex = Assert.Throws(() => - { - var config = CreateBuilder() - .AddDaprSecretStore("store", null) - .Build(); - }); + { + CreateBuilder() + .AddDaprSecretStore("store", null) + .Build(); + }); Assert.Contains("client", ex.Message); } @@ -384,11 +384,11 @@ public void AddDaprSecretStore_DuplicateSecret_ReportsError() .Build(); var ex = Assert.Throws(() => - { - var config = CreateBuilder() - .AddDaprSecretStore("store", daprClient) - .Build(); - }); + { + CreateBuilder() + .AddDaprSecretStore("store", daprClient) + .Build(); + }); Assert.Contains("Please remove any duplicates from your secret store.", ex.Message); }