From 163b935ac42b437e8404c2410b2b0874b323ca96 Mon Sep 17 00:00:00 2001 From: David Pine Date: Fri, 1 Sep 2023 10:40:37 -0500 Subject: [PATCH] Address all IDE0040 warnings. Explicitly provide access modifiers. (#8609) --- src/AdoNet/Shared/Storage/DbExtensions.cs | 2 +- .../GrainDirectory/IDhtGrainDirectory.cs | 2 +- .../LogStorage/LogViewAdaptor.cs | 14 ++++++-------- .../StateStorage/LogViewAdaptor.cs | 10 ++++------ .../Generator/GeneratorAdapterFactory.cs | 2 +- src/Orleans.TestingHost/Utils/AsyncResultHandle.cs | 4 ++-- .../Grains/RemoteCommitService.cs | 2 +- ...ractPropertiesCannotBeSerializedAnalyzerTest.cs | 2 +- ...erateGenerateSerializerAttributeAnalyzerTest.cs | 2 +- .../GenerateSerializationAttributesAnalyzerTest.cs | 2 +- test/Benchmarks/Program.cs | 2 +- .../DefaultCluster.Tests/ClientAddressableTests.cs | 2 +- test/DefaultCluster.Tests/EchoTaskGrainTests.cs | 5 ++--- test/DefaultCluster.Tests/GenericGrainTests.cs | 2 +- test/DefaultCluster.Tests/LocalErrorGrain.cs | 4 ++-- test/DefaultCluster.Tests/MultifacetGrainTest.cs | 7 ++++--- test/DefaultCluster.Tests/ObserverTests.cs | 14 +++++++------- .../PostgreSqlStorageForTesting.cs | 2 +- test/Grains/TestGrains/AsyncSimpleGrain.cs | 2 +- .../ConcreteGrainsWithGenericInterfaces.cs | 6 +++--- .../EventSourcing/SeatReservationGrain.cs | 2 +- .../TestGrains/GeneratedEventReporterGrain.cs | 2 +- test/Grains/TestGrains/GenericGrains.cs | 3 +-- .../TestGrains/ProducerEventCountingGrain.cs | 2 +- .../ProgrammaticSubscribe/TypedProducerGrain.cs | 2 +- test/Grains/TestGrains/ReentrantGrain.cs | 8 ++++---- .../ISerializerPresenceTest.cs | 2 +- .../TestInternalGrains/ReminderTestGrain2.cs | 8 ++++---- .../SerializerPresenceTestGrain.cs | 2 +- test/Grains/TestInternalGrains/TimerGrain.cs | 10 +++++----- test/NonSilo.Tests/General/Identifiertests.cs | 5 +++-- .../SerializationTests.ImmutableCollections.cs | 2 +- test/Orleans.Serialization.UnitTests/Models.cs | 4 ++-- .../EventSourcingTests/CountersGrainPerfTests.cs | 2 +- .../StreamingTests/DeactivationTestRunner.cs | 2 +- .../StreamingTests/SystemTargetRouteTests.cs | 2 +- .../General/ConsistentRingProviderTests_Silo.cs | 2 +- test/TesterInternal/General/RequestContextTest.cs | 4 ++-- .../StorageTests/PersistenceGrainTests.cs | 12 ++++++------ 39 files changed, 80 insertions(+), 84 deletions(-) diff --git a/src/AdoNet/Shared/Storage/DbExtensions.cs b/src/AdoNet/Shared/Storage/DbExtensions.cs index 320df61eec..a4fff350cd 100644 --- a/src/AdoNet/Shared/Storage/DbExtensions.cs +++ b/src/AdoNet/Shared/Storage/DbExtensions.cs @@ -26,7 +26,7 @@ internal static class DbExtensions /// /// An explicit map of type CLR viz database type conversions. /// - static readonly ReadOnlyDictionary typeMap = new ReadOnlyDictionary(new Dictionary + private static readonly ReadOnlyDictionary typeMap = new ReadOnlyDictionary(new Dictionary { { typeof(object), DbType.Object }, { typeof(int), DbType.Int32 }, diff --git a/src/Orleans.Core/GrainDirectory/IDhtGrainDirectory.cs b/src/Orleans.Core/GrainDirectory/IDhtGrainDirectory.cs index 817d73499a..3ef6de15a3 100644 --- a/src/Orleans.Core/GrainDirectory/IDhtGrainDirectory.cs +++ b/src/Orleans.Core/GrainDirectory/IDhtGrainDirectory.cs @@ -13,7 +13,7 @@ namespace Orleans.GrainDirectory /// The methods here can be called remotely (where extended by IRemoteGrainDirectory) or /// locally (where extended by ILocalGrainDirectory) /// - interface IDhtGrainDirectory + internal interface IDhtGrainDirectory { /// /// Record a new grain activation by adding it to the directory. diff --git a/src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs b/src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs index 8f2d44e775..d3cc2d58bd 100644 --- a/src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs +++ b/src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs @@ -33,17 +33,15 @@ public LogViewAdaptor(ILogViewAdaptorHost host, TLogView in private const int maxEntriesInNotifications = 200; - - - readonly IGrainStorage globalGrainStorage; - readonly string grainTypeName; + private readonly IGrainStorage globalGrainStorage; + private readonly string grainTypeName; // the object containing the entire log, as retrieved from / sent to storage - LogStateWithMetaDataAndETag GlobalLog; + private LogStateWithMetaDataAndETag GlobalLog; // the confirmed view - TLogView ConfirmedViewInternal; - int ConfirmedVersionInternal; + private TLogView ConfirmedViewInternal; + private int ConfirmedVersionInternal; /// protected override TLogView LastConfirmedView() @@ -349,7 +347,7 @@ protected override void ProcessNotifications() #if DEBUG - bool operation_in_progress; + private bool operation_in_progress; #endif [Conditional("DEBUG")] diff --git a/src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs b/src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs index 84b5fec322..003bce455c 100644 --- a/src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs +++ b/src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs @@ -33,11 +33,9 @@ public LogViewAdaptor(ILogViewAdaptorHost host, TLogView in private const int maxEntriesInNotifications = 200; - - - readonly IGrainStorage globalGrainStorage; - readonly string grainTypeName; // stores the confirmed state including metadata - GrainStateWithMetaDataAndETag GlobalStateCache; + private readonly IGrainStorage globalGrainStorage; + private readonly string grainTypeName; // stores the confirmed state including metadata + private GrainStateWithMetaDataAndETag GlobalStateCache; /// protected override TLogView LastConfirmedView() @@ -326,7 +324,7 @@ protected override void ProcessNotifications() #if DEBUG - bool operation_in_progress; + private bool operation_in_progress; #endif [Conditional("DEBUG")] diff --git a/src/Orleans.Streaming/Generator/GeneratorAdapterFactory.cs b/src/Orleans.Streaming/Generator/GeneratorAdapterFactory.cs index 41a2285cd1..179eaa8525 100644 --- a/src/Orleans.Streaming/Generator/GeneratorAdapterFactory.cs +++ b/src/Orleans.Streaming/Generator/GeneratorAdapterFactory.cs @@ -189,7 +189,7 @@ public Task ExecuteCommand(int command, object arg) private class Receiver : IQueueAdapterReceiver { - const int MaxDelayMs = 20; + private const int MaxDelayMs = 20; private readonly IQueueAdapterReceiverMonitor receiverMonitor; public IStreamGenerator QueueGenerator { private get; set; } diff --git a/src/Orleans.TestingHost/Utils/AsyncResultHandle.cs b/src/Orleans.TestingHost/Utils/AsyncResultHandle.cs index 38f63c3eae..0466d02146 100644 --- a/src/Orleans.TestingHost/Utils/AsyncResultHandle.cs +++ b/src/Orleans.TestingHost/Utils/AsyncResultHandle.cs @@ -8,8 +8,8 @@ namespace Orleans.TestingHost.Utils /// public class AsyncResultHandle { - bool done = false; - bool continueFlag = false; + private bool done = false; + private bool continueFlag = false; /// Reset the current result handle public virtual void Reset() diff --git a/src/Orleans.Transactions.TestKit.Base/Grains/RemoteCommitService.cs b/src/Orleans.Transactions.TestKit.Base/Grains/RemoteCommitService.cs index 5549e8c7f8..9cb3d19940 100644 --- a/src/Orleans.Transactions.TestKit.Base/Grains/RemoteCommitService.cs +++ b/src/Orleans.Transactions.TestKit.Base/Grains/RemoteCommitService.cs @@ -17,7 +17,7 @@ public interface IRemoteCommitService // - can produce errors for fault senarios. public class RemoteCommitService : IRemoteCommitService { - readonly ILogger logger; + private readonly ILogger logger; public RemoteCommitService(ILogger logger) { diff --git a/test/Analyzers.Tests/AbstractPropertiesCannotBeSerializedAnalyzerTest.cs b/test/Analyzers.Tests/AbstractPropertiesCannotBeSerializedAnalyzerTest.cs index 0385d8e3d8..5b5253d970 100644 --- a/test/Analyzers.Tests/AbstractPropertiesCannotBeSerializedAnalyzerTest.cs +++ b/test/Analyzers.Tests/AbstractPropertiesCannotBeSerializedAnalyzerTest.cs @@ -7,7 +7,7 @@ namespace Analyzers.Tests; [TestCategory("BVT"), TestCategory("Analyzer")] public class AbstractPropertiesCannotBeSerializedAnalyzerTest : DiagnosticAnalyzerTestBase { - async Task VerifyGeneratedDiagnostic(string code) + private async Task VerifyGeneratedDiagnostic(string code) { var (diagnostics, _) = await GetDiagnosticsAsync(code, new string[0]); diff --git a/test/Analyzers.Tests/GenerateGenerateSerializerAttributeAnalyzerTest.cs b/test/Analyzers.Tests/GenerateGenerateSerializerAttributeAnalyzerTest.cs index 2112766a42..4755897b21 100644 --- a/test/Analyzers.Tests/GenerateGenerateSerializerAttributeAnalyzerTest.cs +++ b/test/Analyzers.Tests/GenerateGenerateSerializerAttributeAnalyzerTest.cs @@ -7,7 +7,7 @@ namespace Analyzers.Tests; [TestCategory("BVT"), TestCategory("Analyzer")] public class GenerateGenerateSerializerAttributeAnalyzerTest : DiagnosticAnalyzerTestBase { - async Task VerifyGeneratedDiagnostic(string code) + private async Task VerifyGeneratedDiagnostic(string code) { var (diagnostics, _) = await GetDiagnosticsAsync(code, new string[0]); diff --git a/test/Analyzers.Tests/GenerateSerializationAttributesAnalyzerTest.cs b/test/Analyzers.Tests/GenerateSerializationAttributesAnalyzerTest.cs index e0b8814faa..18d5fae3f3 100644 --- a/test/Analyzers.Tests/GenerateSerializationAttributesAnalyzerTest.cs +++ b/test/Analyzers.Tests/GenerateSerializationAttributesAnalyzerTest.cs @@ -7,7 +7,7 @@ namespace Analyzers.Tests; [TestCategory("BVT"), TestCategory("Analyzer")] public class GenerateSerializationAttributesAnalyzerTest : DiagnosticAnalyzerTestBase { - async Task VerifyGeneratedDiagnostic(string code) + private async Task VerifyGeneratedDiagnostic(string code) { var (diagnostics, _) = await GetDiagnosticsAsync(code, new string[0]); diff --git a/test/Benchmarks/Program.cs b/test/Benchmarks/Program.cs index 3de42d9dc7..f47c927a5d 100644 --- a/test/Benchmarks/Program.cs +++ b/test/Benchmarks/Program.cs @@ -7,7 +7,7 @@ namespace Benchmarks { - class Program + internal class Program { private static readonly Dictionary> _benchmarks = new Dictionary> { diff --git a/test/DefaultCluster.Tests/ClientAddressableTests.cs b/test/DefaultCluster.Tests/ClientAddressableTests.cs index de2c683db3..0196ab2b1d 100644 --- a/test/DefaultCluster.Tests/ClientAddressableTests.cs +++ b/test/DefaultCluster.Tests/ClientAddressableTests.cs @@ -56,7 +56,7 @@ public void VerifyNumbers(int iterationCount) private class MyProducer : IClientAddressableTestProducer { - int counter = 0; + private int counter = 0; public Task Poll() { diff --git a/test/DefaultCluster.Tests/EchoTaskGrainTests.cs b/test/DefaultCluster.Tests/EchoTaskGrainTests.cs index 749b29dfc3..b2a8b5d443 100644 --- a/test/DefaultCluster.Tests/EchoTaskGrainTests.cs +++ b/test/DefaultCluster.Tests/EchoTaskGrainTests.cs @@ -11,9 +11,8 @@ namespace DefaultCluster.Tests.General public class EchoTaskGrainTests : HostedTestClusterEnsureDefaultStarted { private readonly TimeSpan timeout = Debugger.IsAttached ? TimeSpan.FromMinutes(10) : TimeSpan.FromSeconds(10); - - const string expectedEcho = "Hello from EchoGrain"; - const string expectedEchoError = "Error from EchoGrain"; + private const string expectedEcho = "Hello from EchoGrain"; + private const string expectedEchoError = "Error from EchoGrain"; private IEchoTaskGrain grain; public static readonly TimeSpan Epsilon = TimeSpan.FromSeconds(1); diff --git a/test/DefaultCluster.Tests/GenericGrainTests.cs b/test/DefaultCluster.Tests/GenericGrainTests.cs index a53f18fce5..e00abd5b3b 100644 --- a/test/DefaultCluster.Tests/GenericGrainTests.cs +++ b/test/DefaultCluster.Tests/GenericGrainTests.cs @@ -802,7 +802,7 @@ public GenericEdgeCaseTests(DefaultClusterFixture fixture) : base(fixture) { } - static async Task GetConcreteGenArgs(IBasicGrain @this) { + private static async Task GetConcreteGenArgs(IBasicGrain @this) { var genArgTypeNames = await @this.ConcreteGenArgTypeNames(); return genArgTypeNames.Select(n => Type.GetType(n)) diff --git a/test/DefaultCluster.Tests/LocalErrorGrain.cs b/test/DefaultCluster.Tests/LocalErrorGrain.cs index a1f5cc9431..43c12e4e99 100644 --- a/test/DefaultCluster.Tests/LocalErrorGrain.cs +++ b/test/DefaultCluster.Tests/LocalErrorGrain.cs @@ -2,8 +2,8 @@ { internal class LocalErrorGrain { - int m_a = 0; - int m_b = 0; + private int m_a = 0; + private int m_b = 0; public LocalErrorGrain() { } diff --git a/test/DefaultCluster.Tests/MultifacetGrainTest.cs b/test/DefaultCluster.Tests/MultifacetGrainTest.cs index dfcb89ccaa..acb8c8a860 100644 --- a/test/DefaultCluster.Tests/MultifacetGrainTest.cs +++ b/test/DefaultCluster.Tests/MultifacetGrainTest.cs @@ -7,10 +7,11 @@ namespace DefaultCluster.Tests.General //using ValueUpdateEventArgs = MultifacetGrainClient.ValueUpdateEventArgs; public class MultifacetGrainTest : HostedTestClusterEnsureDefaultStarted { - IMultifacetWriter writer; - IMultifacetReader reader; + private IMultifacetWriter writer; + private IMultifacetReader reader; + //int eventCounter; - const int EXPECTED_NUMBER_OF_EVENTS = 4; + private const int EXPECTED_NUMBER_OF_EVENTS = 4; private readonly TimeSpan timeout = TimeSpan.FromSeconds(5); public MultifacetGrainTest(DefaultClusterFixture fixture) : base(fixture) diff --git a/test/DefaultCluster.Tests/ObserverTests.cs b/test/DefaultCluster.Tests/ObserverTests.cs index 9fb2eae7c8..c82d94a106 100644 --- a/test/DefaultCluster.Tests/ObserverTests.cs +++ b/test/DefaultCluster.Tests/ObserverTests.cs @@ -77,7 +77,7 @@ public async Task ObserverTest_SimpleNotification_GeneratedFactory() this.GrainFactory.DeleteObjectReference(reference); } - void ObserverTest_SimpleNotification_Callback(int a, int b, AsyncResultHandle result) + private void ObserverTest_SimpleNotification_Callback(int a, int b, AsyncResultHandle result) { callbackCounter++; this.Logger.LogInformation("Invoking ObserverTest_SimpleNotification_Callback for {CallbackCounter} time with a = {A} and b = {B}", this.callbackCounter, a, b); @@ -142,7 +142,7 @@ public async Task ObserverTest_DoubleSubscriptionSameReference() this.GrainFactory.DeleteObjectReference(reference); } - void ObserverTest_DoubleSubscriptionSameReference_Callback(int a, int b, AsyncResultHandle result) + private void ObserverTest_DoubleSubscriptionSameReference_Callback(int a, int b, AsyncResultHandle result) { callbackCounter++; this.Logger.LogInformation("Invoking ObserverTest_DoubleSubscriptionSameReference_Callback for {CallbackCounter} time with a={A} and b={B}", this.callbackCounter, a, b); @@ -174,7 +174,7 @@ public async Task ObserverTest_SubscribeUnsubscribe() this.GrainFactory.DeleteObjectReference(reference); } - void ObserverTest_SubscribeUnsubscribe_Callback(int a, int b, AsyncResultHandle result) + private void ObserverTest_SubscribeUnsubscribe_Callback(int a, int b, AsyncResultHandle result) { callbackCounter++; this.Logger.LogInformation("Invoking ObserverTest_SubscribeUnsubscribe_Callback for {CallbackCounter} time with a = {A} and b = {B}", this.callbackCounter, a, b); @@ -233,7 +233,7 @@ public async Task ObserverTest_DoubleSubscriptionDifferentReferences() this.GrainFactory.DeleteObjectReference(reference2); } - void ObserverTest_DoubleSubscriptionDifferentReferences_Callback(int a, int b, AsyncResultHandle result) + private void ObserverTest_DoubleSubscriptionDifferentReferences_Callback(int a, int b, AsyncResultHandle result) { callbackCounter++; this.Logger.LogInformation("Invoking ObserverTest_DoubleSubscriptionDifferentReferences_Callback for {CallbackCounter} time with a = {A} and b = {B}", this.callbackCounter, a, b); @@ -264,7 +264,7 @@ public async Task ObserverTest_DeleteObject() Assert.False(await result.WaitForFinished(timeout), $"Should timeout waiting {timeout} for SetB"); } - void ObserverTest_DeleteObject_Callback(int a, int b, AsyncResultHandle result) + private void ObserverTest_DeleteObject_Callback(int a, int b, AsyncResultHandle result) { callbackCounter++; this.Logger.LogInformation("Invoking ObserverTest_DeleteObject_Callback for {CallbackCounter} time with a = {A} and b = {B}", this.callbackCounter, a, b); @@ -319,8 +319,8 @@ public void StateChanged(int a, int b) { } internal class SimpleGrainObserver : ISimpleGrainObserver { - readonly Action action; - readonly AsyncResultHandle result; + private readonly Action action; + private readonly AsyncResultHandle result; private readonly ILogger logger; diff --git a/test/Extensions/TesterAdoNet/RelationalUtilities/PostgreSqlStorageForTesting.cs b/test/Extensions/TesterAdoNet/RelationalUtilities/PostgreSqlStorageForTesting.cs index 699d639e40..e944859c01 100644 --- a/test/Extensions/TesterAdoNet/RelationalUtilities/PostgreSqlStorageForTesting.cs +++ b/test/Extensions/TesterAdoNet/RelationalUtilities/PostgreSqlStorageForTesting.cs @@ -4,7 +4,7 @@ namespace Tester.RelationalUtilities { - class PostgreSqlStorageForTesting : RelationalStorageForTesting + internal class PostgreSqlStorageForTesting : RelationalStorageForTesting { protected override string ProviderMoniker => "PostgreSQL"; diff --git a/test/Grains/TestGrains/AsyncSimpleGrain.cs b/test/Grains/TestGrains/AsyncSimpleGrain.cs index 4708022231..736089692e 100644 --- a/test/Grains/TestGrains/AsyncSimpleGrain.cs +++ b/test/Grains/TestGrains/AsyncSimpleGrain.cs @@ -8,7 +8,7 @@ namespace UnitTests.Grains /// public class AsyncSimpleGrain : SimpleGrain, ISimpleGrainWithAsyncMethods { - TaskCompletionSource resolver; + private TaskCompletionSource resolver; public AsyncSimpleGrain(ILoggerFactory loggerFactory) : base(loggerFactory) { diff --git a/test/Grains/TestGrains/ConcreteGrainsWithGenericInterfaces.cs b/test/Grains/TestGrains/ConcreteGrainsWithGenericInterfaces.cs index 58a965bfb7..8b15c9e7bd 100644 --- a/test/Grains/TestGrains/ConcreteGrainsWithGenericInterfaces.cs +++ b/test/Grains/TestGrains/ConcreteGrainsWithGenericInterfaces.cs @@ -2,7 +2,7 @@ namespace UnitTests.Grains { - class ConcreteGrainWithGenericInterfaceOfIntFloat : Grain, IGenericGrain + internal class ConcreteGrainWithGenericInterfaceOfIntFloat : Grain, IGenericGrain { protected int T { get; set; } @@ -18,7 +18,7 @@ public Task MapT2U() } } - class ConcreteGrainWithGenericInterfaceOfFloatString : Grain, IGenericGrain + internal class ConcreteGrainWithGenericInterfaceOfFloatString : Grain, IGenericGrain { protected float T { get; set; } @@ -34,7 +34,7 @@ public Task MapT2U() } } - class ConcreteGrainWith2GenericInterfaces : Grain, IGenericGrain, ISimpleGenericGrain + internal class ConcreteGrainWith2GenericInterfaces : Grain, IGenericGrain, ISimpleGenericGrain { // IGenericGrain methods: diff --git a/test/Grains/TestGrains/EventSourcing/SeatReservationGrain.cs b/test/Grains/TestGrains/EventSourcing/SeatReservationGrain.cs index dc5151c72a..cb87c7454d 100644 --- a/test/Grains/TestGrains/EventSourcing/SeatReservationGrain.cs +++ b/test/Grains/TestGrains/EventSourcing/SeatReservationGrain.cs @@ -53,7 +53,7 @@ public ReservationState() Reservations = new Dictionary(); } - void Apply(SeatReservation reservation) + private void Apply(SeatReservation reservation) { // see if this reservation targets an available seat // otherwise, treat it as a no-op diff --git a/test/Grains/TestGrains/GeneratedEventReporterGrain.cs b/test/Grains/TestGrains/GeneratedEventReporterGrain.cs index 765f62a8f2..a4f41bd7c5 100644 --- a/test/Grains/TestGrains/GeneratedEventReporterGrain.cs +++ b/test/Grains/TestGrains/GeneratedEventReporterGrain.cs @@ -4,7 +4,7 @@ namespace TestGrains { - class GeneratedEventReporterGrain : Grain, IGeneratedEventReporterGrain + internal class GeneratedEventReporterGrain : Grain, IGeneratedEventReporterGrain { private readonly ILogger logger; diff --git a/test/Grains/TestGrains/GenericGrains.cs b/test/Grains/TestGrains/GenericGrains.cs index 6e6c1f71f6..0506fa8355 100644 --- a/test/Grains/TestGrains/GenericGrains.cs +++ b/test/Grains/TestGrains/GenericGrains.cs @@ -859,8 +859,7 @@ public Task ConcreteGenArgTypeNames() { ); } - - Type GetImmediateSubclass(Type subject) { + private Type GetImmediateSubclass(Type subject) { if(subject.BaseType == typeof(BasicGrain)) { return subject; } diff --git a/test/Grains/TestGrains/ProducerEventCountingGrain.cs b/test/Grains/TestGrains/ProducerEventCountingGrain.cs index 6d89bcae5a..6d9de08c92 100644 --- a/test/Grains/TestGrains/ProducerEventCountingGrain.cs +++ b/test/Grains/TestGrains/ProducerEventCountingGrain.cs @@ -4,7 +4,7 @@ namespace UnitTests.Grains { - class ProducerEventCountingGrain : BaseGrain, IProducerEventCountingGrain + internal class ProducerEventCountingGrain : BaseGrain, IProducerEventCountingGrain { private IAsyncObserver _producer; private int _numProducedItems; diff --git a/test/Grains/TestGrains/ProgrammaticSubscribe/TypedProducerGrain.cs b/test/Grains/TestGrains/ProgrammaticSubscribe/TypedProducerGrain.cs index 4aed8aaf4c..90897efaab 100644 --- a/test/Grains/TestGrains/ProgrammaticSubscribe/TypedProducerGrain.cs +++ b/test/Grains/TestGrains/ProgrammaticSubscribe/TypedProducerGrain.cs @@ -131,7 +131,7 @@ protected override Task ProducerOnNextAsync(IAsyncStream theProducer) public class Apple : IFruit { [Id(0)] - readonly int number; + private readonly int number; public Apple(int number) { diff --git a/test/Grains/TestGrains/ReentrantGrain.cs b/test/Grains/TestGrains/ReentrantGrain.cs index 48d49332b8..6535a00cb8 100644 --- a/test/Grains/TestGrains/ReentrantGrain.cs +++ b/test/Grains/TestGrains/ReentrantGrain.cs @@ -103,7 +103,7 @@ public static bool MayInterleave(IInvokable req) return arg == "reentrant"; } - static object UnwrapImmutable(object item) => item is Immutable ? ((Immutable)item).Value : item; + private static object UnwrapImmutable(object item) => item is Immutable ? ((Immutable)item).Value : item; private IMayInterleaveStaticPredicateGrain Self { get; set; } @@ -145,7 +145,7 @@ public Task PushToStream(string item) return GetStream().OnNextAsync(item); } - IAsyncStream GetStream() => + private IAsyncStream GetStream() => this.GetStreamProvider("sms").GetStream("test-stream-interleave", Guid.Empty); public Task SetSelf(IMayInterleaveStaticPredicateGrain self) @@ -187,7 +187,7 @@ public bool MayInterleave(IInvokable req) return arg == "reentrant"; } - static object UnwrapImmutable(object item) => item is Immutable ? ((Immutable)item).Value : item; + private static object UnwrapImmutable(object item) => item is Immutable ? ((Immutable)item).Value : item; private IMayInterleaveInstancedPredicateGrain Self { get; set; } @@ -229,7 +229,7 @@ public Task PushToStream(string item) return GetStream().OnNextAsync(item); } - IAsyncStream GetStream() => + private IAsyncStream GetStream() => this.GetStreamProvider("sms").GetStream("test-stream-interleave", Guid.Empty); public Task SetSelf(IMayInterleaveInstancedPredicateGrain self) diff --git a/test/Grains/TestInternalGrainInterfaces/ISerializerPresenceTest.cs b/test/Grains/TestInternalGrainInterfaces/ISerializerPresenceTest.cs index 667b313d89..1cd25e79ea 100644 --- a/test/Grains/TestInternalGrainInterfaces/ISerializerPresenceTest.cs +++ b/test/Grains/TestInternalGrainInterfaces/ISerializerPresenceTest.cs @@ -1,6 +1,6 @@ namespace UnitTests.GrainInterfaces { - interface ISerializerPresenceTest : IGrainWithGuidKey + internal interface ISerializerPresenceTest : IGrainWithGuidKey { Task SerializerExistsForType(System.Type param); diff --git a/test/Grains/TestInternalGrains/ReminderTestGrain2.cs b/test/Grains/TestInternalGrains/ReminderTestGrain2.cs index 0cc240d4a5..53db189398 100644 --- a/test/Grains/TestInternalGrains/ReminderTestGrain2.cs +++ b/test/Grains/TestInternalGrains/ReminderTestGrain2.cs @@ -17,8 +17,8 @@ public class ReminderTestGrain2 : Grain, IReminderTestGrain2, IRemindable private readonly IReminderTable reminderTable; private readonly IReminderRegistry unvalidatedReminderRegistry; - Dictionary allReminders; - Dictionary sequence; + private Dictionary allReminders; + private Dictionary sequence; private TimeSpan period; private static readonly long aCCURACY = 50 * TimeSpan.TicksPerMillisecond; // when we use ticks to compute sequence numbers, we might get wrong results as timeouts don't happen with precision of ticks ... we keep this as a leeway @@ -232,8 +232,8 @@ public async Task EraseReminderTable() public class ReminderTestCopyGrain : Grain, IReminderTestCopyGrain, IRemindable { private readonly IReminderRegistry unvalidatedReminderRegistry; - Dictionary allReminders; - Dictionary sequence; + private Dictionary allReminders; + private Dictionary sequence; private TimeSpan period; private static readonly long aCCURACY = 50 * TimeSpan.TicksPerMillisecond; // when we use ticks to compute sequence numbers, we might get wrong results as timeouts don't happen with precision of ticks ... we keep this as a leeway diff --git a/test/Grains/TestInternalGrains/SerializerPresenceTestGrain.cs b/test/Grains/TestInternalGrains/SerializerPresenceTestGrain.cs index 42dafbb378..3aedb9058f 100644 --- a/test/Grains/TestInternalGrains/SerializerPresenceTestGrain.cs +++ b/test/Grains/TestInternalGrains/SerializerPresenceTestGrain.cs @@ -4,7 +4,7 @@ namespace UnitTests.Grains { - class SerializerPresenceTestGrain : Grain, ISerializerPresenceTest + internal class SerializerPresenceTestGrain : Grain, ISerializerPresenceTest { public Task SerializerExistsForType(Type t) { diff --git a/test/Grains/TestInternalGrains/TimerGrain.cs b/test/Grains/TestInternalGrains/TimerGrain.cs index 2783daaa10..6493037564 100644 --- a/test/Grains/TestInternalGrains/TimerGrain.cs +++ b/test/Grains/TestInternalGrains/TimerGrain.cs @@ -10,12 +10,12 @@ namespace UnitTestGrains public class TimerGrain : Grain, ITimerGrain { private bool deactivating; - int counter = 0; - Dictionary allTimers; - IDisposable defaultTimer; + private int counter = 0; + private Dictionary allTimers; + private IDisposable defaultTimer; private static readonly TimeSpan period = TimeSpan.FromMilliseconds(100); - readonly string DefaultTimerName = "DEFAULT TIMER"; - IGrainContext context; + private readonly string DefaultTimerName = "DEFAULT TIMER"; + private IGrainContext context; private readonly ILogger logger; diff --git a/test/NonSilo.Tests/General/Identifiertests.cs b/test/NonSilo.Tests/General/Identifiertests.cs index 2efd2bceb2..faf66e1842 100644 --- a/test/NonSilo.Tests/General/Identifiertests.cs +++ b/test/NonSilo.Tests/General/Identifiertests.cs @@ -17,8 +17,9 @@ public class IdentifierTests private readonly TestEnvironmentFixture environment; private static Random random => Random.Shared; - class A { } - class B : A { } + private class A { } + + private class B : A { } public IdentifierTests(ITestOutputHelper output, TestEnvironmentFixture fixture) { diff --git a/test/NonSilo.Tests/Serialization/SerializationTests.ImmutableCollections.cs b/test/NonSilo.Tests/Serialization/SerializationTests.ImmutableCollections.cs index fb4086ebec..5078b396d8 100644 --- a/test/NonSilo.Tests/Serialization/SerializationTests.ImmutableCollections.cs +++ b/test/NonSilo.Tests/Serialization/SerializationTests.ImmutableCollections.cs @@ -14,7 +14,7 @@ public SerializationTestsImmutableCollections(TestEnvironmentFixture fixture) this.fixture = fixture; } - void RoundTripCollectionSerializationTest(IEnumerable input) + private void RoundTripCollectionSerializationTest(IEnumerable input) { var output = this.fixture.Serializer.RoundTripSerializationForTesting(input); Assert.Equal(input,output); diff --git a/test/Orleans.Serialization.UnitTests/Models.cs b/test/Orleans.Serialization.UnitTests/Models.cs index f099645aa7..114cea357d 100644 --- a/test/Orleans.Serialization.UnitTests/Models.cs +++ b/test/Orleans.Serialization.UnitTests/Models.cs @@ -63,12 +63,12 @@ public sealed class MyJsonSerializableAttribute : Attribute { } -interface IMyBase +internal interface IMyBase { MyValue BaseValue { get; set; } } -interface IMySub : IMyBase +internal interface IMySub : IMyBase { MyValue SubValue { get; set; } } diff --git a/test/Tester/EventSourcingTests/CountersGrainPerfTests.cs b/test/Tester/EventSourcingTests/CountersGrainPerfTests.cs index 9fa38f218a..c66ad2c5ce 100644 --- a/test/Tester/EventSourcingTests/CountersGrainPerfTests.cs +++ b/test/Tester/EventSourcingTests/CountersGrainPerfTests.cs @@ -90,7 +90,7 @@ public async Task Perf_ConfirmAtEndOnly_MemoryLogStore_Reentrant() } - class RunThisFirstAttribute : Attribute + internal class RunThisFirstAttribute : Attribute { } diff --git a/test/Tester/StreamingTests/DeactivationTestRunner.cs b/test/Tester/StreamingTests/DeactivationTestRunner.cs index 4bb4fa3b54..2ac9345abc 100644 --- a/test/Tester/StreamingTests/DeactivationTestRunner.cs +++ b/test/Tester/StreamingTests/DeactivationTestRunner.cs @@ -7,7 +7,7 @@ namespace UnitTests.StreamingTests { - class DeactivationTestRunner + internal class DeactivationTestRunner { private static readonly TimeSpan Timeout = TimeSpan.FromSeconds(10); private readonly string streamProviderName; diff --git a/test/Tester/StreamingTests/SystemTargetRouteTests.cs b/test/Tester/StreamingTests/SystemTargetRouteTests.cs index b26a400b29..15bad3a3b5 100644 --- a/test/Tester/StreamingTests/SystemTargetRouteTests.cs +++ b/test/Tester/StreamingTests/SystemTargetRouteTests.cs @@ -88,7 +88,7 @@ public async Task PersistentStreamingOverSingleGatewayTest() await TestingUtils.WaitUntilAsync(lastTry => CheckCounters(counts.Sum(), lastTry), Timeout); } - Task OnNextAsync(int e, StreamSequenceToken token) + private Task OnNextAsync(int e, StreamSequenceToken token) { Interlocked.Increment(ref this.eventsConsumed); return Task.CompletedTask; diff --git a/test/TesterInternal/General/ConsistentRingProviderTests_Silo.cs b/test/TesterInternal/General/ConsistentRingProviderTests_Silo.cs index 90e2bb3843..ed4752a070 100644 --- a/test/TesterInternal/General/ConsistentRingProviderTests_Silo.cs +++ b/test/TesterInternal/General/ConsistentRingProviderTests_Silo.cs @@ -18,7 +18,7 @@ public class ConsistentRingProviderTests_Silo : TestClusterPerTest private readonly TimeSpan failureTimeout = TimeSpan.FromSeconds(30); private readonly TimeSpan endWait = TimeSpan.FromMinutes(5); - enum Fail { First, Random, Last } + private enum Fail { First, Random, Last } protected override void ConfigureTestCluster(TestClusterBuilder builder) { diff --git a/test/TesterInternal/General/RequestContextTest.cs b/test/TesterInternal/General/RequestContextTest.cs index aa80bf704a..1f5cfca1d5 100644 --- a/test/TesterInternal/General/RequestContextTest.cs +++ b/test/TesterInternal/General/RequestContextTest.cs @@ -309,8 +309,8 @@ public async Task RequestContext_ActivityId_CM_DynamicChange_Client() internal class RequestContextGrainObserver : ISimpleGrainObserver { private readonly ITestOutputHelper output; - readonly Action action; - readonly object result; + private readonly Action action; + private readonly object result; public RequestContextGrainObserver(ITestOutputHelper output, Action action, object result) { diff --git a/test/TesterInternal/StorageTests/PersistenceGrainTests.cs b/test/TesterInternal/StorageTests/PersistenceGrainTests.cs index 3980089393..01dd0570ca 100644 --- a/test/TesterInternal/StorageTests/PersistenceGrainTests.cs +++ b/test/TesterInternal/StorageTests/PersistenceGrainTests.cs @@ -46,11 +46,11 @@ public void Configure(ISiloBuilder hostBuilder) } } - const string DefaultGrainStateName = "state"; - const string MockStorageProviderName1 = "test1"; - const string MockStorageProviderName2 = "test2"; - const string MockStorageProviderNameLowerCase = "lowercase"; - const string ErrorInjectorProviderName = "ErrorInjector"; + private const string DefaultGrainStateName = "state"; + private const string MockStorageProviderName1 = "test1"; + private const string MockStorageProviderName2 = "test2"; + private const string MockStorageProviderNameLowerCase = "lowercase"; + private const string ErrorInjectorProviderName = "ErrorInjector"; private readonly ITestOutputHelper output; protected TestCluster HostedCluster { get; } @@ -1277,7 +1277,7 @@ private ProviderState GetStateForStorageProviderInUse(string providerName, strin return providerState; } - class ProviderState + private class ProviderState { public MockStorageProvider.StateForTest ProviderStateForTest { get; set; } public PersistenceTestGrainState LastStoredGrainState { get; set; }