diff --git a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs index ec02badf8a..f94ffbf736 100644 --- a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs +++ b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogDataCollector.cs @@ -131,6 +131,9 @@ internal EventLogDataCollector(IFileHelper fileHelper) /// internal Dictionary ContextMap { get; } + + #region DataCollector Members + /// /// Initializes the data collector /// @@ -179,6 +182,7 @@ public override void Initialize( events.TestCaseEnd += _testCaseEndEventHandler; } + #endregion /// /// The write event logs. /// @@ -275,6 +279,9 @@ internal string WriteEventLogs(List eventLogEntries, int maxLogEn return eventLogPath; } + + #region IDisposable Members + /// /// Cleans up resources allocated by the data collector /// @@ -299,6 +306,8 @@ protected override void Dispose(bool disposing) RemoveTempEventLogDirs(_eventLogDirectories); } + #endregion + private static ISet ParseCommaSeparatedList(string commaSeparatedList) { ISet strings = new HashSet(); diff --git a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Friends.cs b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Friends.cs index 559d3f1049..be8966e10f 100644 --- a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Friends.cs +++ b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Friends.cs @@ -3,5 +3,8 @@ using System.Runtime.CompilerServices; +#region Test Assemblies + [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +#endregion diff --git a/src/Microsoft.TestPlatform.Build/Friends.cs b/src/Microsoft.TestPlatform.Build/Friends.cs index d2973dd46b..96425d0028 100644 --- a/src/Microsoft.TestPlatform.Build/Friends.cs +++ b/src/Microsoft.TestPlatform.Build/Friends.cs @@ -3,5 +3,8 @@ using System.Runtime.CompilerServices; +#region Test Assemblies + [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Build.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs index b918767204..975cc1f2fd 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs @@ -561,6 +561,8 @@ private void StopTestSession(StopTestSessionPayload payload, ITestRequestManager }); } + #region IDisposable Support + private bool _disposedValue; // To detect redundant calls protected virtual void Dispose(bool disposing) @@ -582,4 +584,5 @@ public void Dispose() // Do not change this code. Put cleanup code in Dispose(bool disposing) above. Dispose(true); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs index 7711b52e47..6ca31c3f6b 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeTestEventsRegistrar.cs @@ -23,6 +23,8 @@ public DesignModeTestEventsRegistrar(IDesignModeClient designModeClient) _designModeClient = designModeClient; } + #region ITestDiscoveryEventsRegistrar + public void RegisterDiscoveryEvents(IDiscoveryRequest discoveryRequest) { discoveryRequest.OnRawMessageReceived += OnRawMessageReceived; @@ -33,6 +35,10 @@ public void UnregisterDiscoveryEvents(IDiscoveryRequest discoveryRequest) discoveryRequest.OnRawMessageReceived -= OnRawMessageReceived; } + #endregion + + #region ITestRunEventsRegistrar + public void RegisterTestRunEvents(ITestRunRequest testRunRequest) { testRunRequest.OnRawMessageReceived += OnRawMessageReceived; @@ -43,6 +49,8 @@ public void UnregisterTestRunEvents(ITestRunRequest testRunRequest) testRunRequest.OnRawMessageReceived -= OnRawMessageReceived; } + #endregion + /// /// RawMessage received handler for getting rawmessages directly from the host /// diff --git a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs index cf5ff1970a..bab03622ff 100644 --- a/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Discovery/DiscoveryRequest.cs @@ -200,6 +200,8 @@ public DiscoveryCriteria DiscoveryCriteria /// internal ITestLoggerManager LoggerManager { get; } + #region ITestDiscoveryEventsHandler2 Methods + /// public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryCompleteEventArgs, IEnumerable lastChunk) { @@ -417,6 +419,10 @@ private string UpdateRawMessageWithTelemetryInfo(DiscoveryCompletePayload discov return rawMessage; } + #endregion + + #region IDisposable implementation + /// /// Performs application-defined tasks associated with freeing, releasing, or /// resetting unmanaged resources. @@ -453,6 +459,7 @@ private void Dispose(bool disposing) EqtTrace.Info("DiscoveryRequest.Dispose: Completed."); } + #endregion /// /// Request Data /// diff --git a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs index 76c64fe106..325218b656 100644 --- a/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs +++ b/src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs @@ -94,6 +94,8 @@ internal TestRunRequest(IRequestData requestData, TestRunCriteria testRunCriteri _requestData = requestData; } + #region ITestRunRequest + /// /// Execute the test run asynchronously /// @@ -327,6 +329,10 @@ internal ITestLoggerManager LoggerManager get; private set; } + #endregion + + #region IDisposable implementation + // Summary: // Performs application-defined tasks associated with freeing, releasing, or // resetting unmanaged resources. @@ -337,6 +343,8 @@ public void Dispose() GC.SuppressFinalize(this); } + #endregion + /// /// The criteria/config for this test run request. /// diff --git a/src/Microsoft.TestPlatform.Client/Friends.cs b/src/Microsoft.TestPlatform.Client/Friends.cs index 10115cbe91..90a5d9db6f 100644 --- a/src/Microsoft.TestPlatform.Client/Friends.cs +++ b/src/Microsoft.TestPlatform.Client/Friends.cs @@ -3,5 +3,12 @@ using System.Runtime.CompilerServices; +#region Product Assemblies + +#endregion + +#region Test Assemblies + [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Client.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.Common/Friends.cs b/src/Microsoft.TestPlatform.Common/Friends.cs index fd476bf868..ea3f0a478d 100644 --- a/src/Microsoft.TestPlatform.Common/Friends.cs +++ b/src/Microsoft.TestPlatform.Common/Friends.cs @@ -3,6 +3,7 @@ using System.Runtime.CompilerServices; +#region Product Assemblies [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("datacollector, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] @@ -10,6 +11,9 @@ [assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Common, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Client, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion + +#region Test Assemblies [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Common.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] @@ -21,3 +25,4 @@ [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.AcceptanceTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs index a0f0ae8b4a..1f9a956357 100644 --- a/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs +++ b/src/Microsoft.TestPlatform.Common/Logging/InternalTestLoggerEvents.cs @@ -113,6 +113,9 @@ public InternalTestLoggerEvents(TestSessionMessageLogger testSessionMessageLogge /// public override event EventHandler DiscoveryComplete; + + #region IDisposable + /// /// Waits for all pending messages to be processed by the loggers cleans up. /// @@ -132,6 +135,8 @@ public void Dispose() _loggerEventQueue.Dispose(); } + #endregion + /// /// Enables sending of events to the loggers which are registered and flushes the queue. /// diff --git a/src/Microsoft.TestPlatform.Common/RunSettingsManager.cs b/src/Microsoft.TestPlatform.Common/RunSettingsManager.cs index d0d2d07aa5..e83834144d 100644 --- a/src/Microsoft.TestPlatform.Common/RunSettingsManager.cs +++ b/src/Microsoft.TestPlatform.Common/RunSettingsManager.cs @@ -27,11 +27,15 @@ private RunSettingsManager() } + + #region IRunSettingsProvider + /// /// Gets the active run settings. /// public RunSettings ActiveRunSettings { get; private set; } + #endregion public static RunSettingsManager Instance { get diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs index 67432548bb..4a66d4f39f 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs @@ -89,6 +89,8 @@ internal SocketCommunicationManager(IDataSerializer dataSerializer) _dataSerializer = dataSerializer; } + #region ServerMethods + /// /// Host TCP Socket Server and start listening /// @@ -154,6 +156,10 @@ public void StopServer() _binaryWriter?.Dispose(); } + #endregion + + #region ClientMethods + /// /// Connects to server async /// @@ -233,6 +239,8 @@ public void StopClient() _binaryWriter?.Dispose(); } + #endregion + /// /// Writes message to the binary writer. /// diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index 5a956881ea..142ebfb97d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -244,6 +244,8 @@ public void CheckVersionWithTestHost() } } + #region Discovery Protocol + /// public void InitializeDiscovery(IEnumerable pathToAdditionalExtensions) { @@ -274,6 +276,10 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve _channel.Send(message); } + #endregion + + #region Execution Protocol + /// public void InitializeExecution(IEnumerable pathToAdditionalExtensions) { @@ -401,6 +407,8 @@ public void SendTestRunAbort() _channel?.Send(_dataSerializer.SerializeMessage(MessageType.AbortTestRun)); } + #endregion + /// public void EndSession() { diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs index fecfca23b0..d4f3b23b47 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelOperationManager.cs @@ -20,6 +20,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client; /// internal abstract class ParallelOperationManager : IParallelOperationManager, IDisposable { + #region ConcurrentManagerInstanceData + protected Func CreateNewConcurrentManager { get; set; } /// @@ -39,12 +41,18 @@ internal abstract class ParallelOperationManager : IParallelOperationMana /// private int _currentParallelLevel; + #endregion + + #region Concurrency Keeper Objects + /// /// LockObject to iterate our sourceEnumerator in parallel /// We can use the sourceEnumerator itself as lockObject, but since its a changing object - it's risky to use it as one /// protected object _sourceEnumeratorLockObject = new(); + #endregion + protected ParallelOperationManager(Func createNewManager, int parallelLevel, bool sharedHosts) { CreateNewConcurrentManager = createNewManager; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs index ed8601657b..7ad7a42ed0 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyDiscoveryManager.cs @@ -25,6 +25,8 @@ internal class ParallelProxyDiscoveryManager : ParallelOperationManager /// LockObject to update discovery status in parallel /// private readonly object _discoveryStatusLockObject = new(); + #endregion + public ParallelProxyDiscoveryManager(IRequestData requestData, Func actualProxyManagerCreator, int parallelLevel, bool sharedHosts) : this(requestData, actualProxyManagerCreator, JsonDataSerializer.Instance, parallelLevel, sharedHosts) { @@ -58,6 +66,8 @@ internal ParallelProxyDiscoveryManager(IRequestData requestData, Func public void Initialize(bool skipDefaultAdapters) { @@ -91,6 +101,10 @@ public void Close() DoActionOnAllManagers(proxyManager => proxyManager.Close(), doActionsInParallel: true); } + #endregion + + #region IParallelProxyDiscoveryManager methods + /// public bool HandlePartialDiscoveryComplete(IProxyDiscoveryManager proxyDiscoveryManager, long totalTests, IEnumerable lastChunk, bool isAborted) { @@ -152,6 +166,8 @@ Now when both.net framework and.net core projects can run in parallel return false; } + #endregion + private void DiscoverTestsPrivate(ITestDiscoveryEventsHandler2 discoveryEventsHandler) { _currentDiscoveryEventsHandler = discoveryEventsHandler; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs index bfb1945000..641d5cfcef 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/Parallel/ParallelProxyExecutionManager.cs @@ -31,6 +31,8 @@ internal class ParallelProxyExecutionManager : ParallelOperationManager public bool IsInitialized { get; private set; } + #endregion + + #region Concurrency Keeper Objects + /// /// LockObject to update execution status in parallel /// private readonly object _executionStatusLockObject = new(); + #endregion + public ParallelProxyExecutionManager(IRequestData requestData, Func actualProxyManagerCreator, int parallelLevel) : this(requestData, actualProxyManagerCreator, JsonDataSerializer.Instance, parallelLevel, true) { @@ -78,6 +86,8 @@ internal ParallelProxyExecutionManager(IRequestData requestData, Func proxyManager.Close(), doActionsInParallel: true); } + #endregion + + #region IParallelProxyExecutionManager methods + /// /// Handles Partial Run Complete event coming from a specific concurrent proxy execution manager /// Each concurrent proxy execution manager will signal the parallel execution manager when its complete @@ -207,6 +221,8 @@ public bool HandlePartialRunComplete( return false; } + #endregion + private int StartTestRunPrivate(ITestRunEventsHandler runEventsHandler) { _currentRunEventsHandler = runEventsHandler; diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs index 4ebe49cf0b..b254d2e55a 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyDiscoveryManager.cs @@ -116,6 +116,9 @@ internal ProxyDiscoveryManager( _proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); } + + #region IProxyDiscoveryManager implementation. + /// public void Initialize(bool skipDefaultAdapters) { @@ -245,6 +248,9 @@ public void HandleLogMessage(TestMessageLevel level, string message) _baseTestDiscoveryEventsHandler.HandleLogMessage(level, message); } + #endregion + + #region IBaseProxy implementation. /// public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartInfo testProcessStartInfo) { @@ -253,6 +259,8 @@ public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartI testProcessStartInfo.Arguments += " --telemetryoptedin " + telemetryOptedIn; return testProcessStartInfo; } + #endregion + private void InitializeExtensions(IEnumerable sources) { var extensions = TestPluginCache.Instance.GetExtensionPaths(TestPlatformConstants.TestAdapterEndsWithPattern, _skipDefaultAdapters); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs index 09facbdb53..772b079a07 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs @@ -136,6 +136,9 @@ internal ProxyExecutionManager( _proxyOperationManager = new ProxyOperationManager(requestData, requestSender, testHostManager, this); } + + #region IProxyExecutionManager implementation. + /// public virtual void Initialize(bool skipDefaultAdapters) { @@ -372,6 +375,9 @@ public void HandleLogMessage(TestMessageLevel level, string message) _baseTestRunEventsHandler.HandleLogMessage(level, message); } + #endregion + + #region IBaseProxy implementation. /// public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartInfo testProcessStartInfo) { @@ -380,6 +386,8 @@ public virtual TestProcessStartInfo UpdateTestProcessStartInfo(TestProcessStartI testProcessStartInfo.Arguments += " --telemetryoptedin " + telemetryOptedIn; return testProcessStartInfo; } + #endregion + /// /// Ensures that the engine is ready for test operations. Usually includes starting up the /// test host process. diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index 8cccb4bba7..530aca8b9c 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -117,6 +117,8 @@ public ProxyOperationManager( /// Gets or sets the cancellation token source. /// public CancellationTokenSource CancellationTokenSource { get; set; } + + #region IProxyOperationManager implementation. /// /// Initializes the proxy. /// @@ -330,6 +332,8 @@ public virtual void Close() } } + #endregion + /// /// This method is exposed to enable derived classes to modify /// . For example, data collectors need additional diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs index f09f68d786..0c5d1e3566 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Execution/ExecutionManager.cs @@ -56,6 +56,8 @@ protected ExecutionManager(ITestPlatformEventSource testPlatformEventSource, IRe _requestData = requestData; } + #region IExecutionManager Implementation + /// /// Initializes the execution manager. /// @@ -183,6 +185,7 @@ public void Abort(ITestRunEventsHandler testRunEventsHandler) } } + #endregion private void LoadExtensions() { try diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs index 89ecdd89ea..e8ea9e69c3 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/TestEngine.cs @@ -50,6 +50,8 @@ protected TestEngine( _processHelper = processHelper; } + #region ITestEngine implementation + /// public IProxyDiscoveryManager GetDiscoveryManager( IRequestData requestData, @@ -359,6 +361,8 @@ public ITestLoggerManager GetLoggerManager(IRequestData requestData) new InternalTestLoggerEvents(TestSessionMessageLogger.Instance)); } + #endregion + private static int GetDistinctNumberOfSources(TestRunCriteria testRunCriteria) { // No point in creating more processes if number of sources is less than what the user diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs index 73c24fd635..71037cde6b 100644 --- a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/BlameLogger.cs @@ -61,6 +61,9 @@ protected BlameLogger(IOutput output, IBlameReaderWriter blameReaderWriter) _blameReaderWriter = blameReaderWriter; } + + #region ITestLogger + /// /// Initializes the Logger. /// @@ -104,6 +107,10 @@ private void TestRunCompleteHandler(object sender!!, TestRunCompleteEventArgs e) _output.Error(false, Resources.Resources.AbortedTestRun, sb.ToString()); } + #endregion + + #region Faulty test case fetch + /// /// Fetches faulty test case /// @@ -139,4 +146,5 @@ private IEnumerable GetFaultyTestCaseNames(TestRunCompleteEventArgs e) return faultyTestCaseNames; } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs index ead6ee8c3a..6b0b46c20b 100644 --- a/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs +++ b/src/Microsoft.TestPlatform.Extensions.HtmlLogger/Friends.cs @@ -3,5 +3,8 @@ using System.Runtime.CompilerServices; +#region Test Assemblies + [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.HtmlLogger.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Friends.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Friends.cs index 30a5704544..a0a0c719df 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Friends.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Friends.cs @@ -3,5 +3,8 @@ using System.Runtime.CompilerServices; +#region Test Assemblies + [assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs index 9203762cbf..52fc4ea45c 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/CollectorDataEntry.cs @@ -134,6 +134,9 @@ public IList Attachments } } + + #region IXmlTestStore Members + /// /// Saves the state to the XML element /// @@ -162,6 +165,7 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) helper.SaveIEnumerable(uriAttachments, element, "UriAttachments", "A", "UriAttachment", parameters); } + #endregion /// /// Adds a data attachment to the list of data attachments /// diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/RunInfo.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/RunInfo.cs index 5b50820d40..6e4f8d5897 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/RunInfo.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/RunInfo.cs @@ -56,6 +56,9 @@ public RunInfo(string textMessage, Exception ex, string computer, TestOutcome ou _timestamp = DateTime.UtcNow; } + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -72,4 +75,5 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) helper.SaveSimpleField(element, "Exception", _exception, null); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs index 03bd155bc8..2fd869fe22 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestCategoryItems.cs @@ -13,6 +13,7 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; using XML; +#region TestCategoryItem /// /// Stores a string which categorizes the Test /// @@ -92,6 +93,9 @@ public override string ToString() Debug.Assert(_category != null, "category is null"); return _category; } + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement. /// @@ -102,7 +106,11 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter new XmlPersistence().SaveSingleFields(element, this, parameters); } + #endregion } +#endregion + +#region TestCategoryItemCollection /// /// A collection of strings which categorize the test. /// @@ -240,3 +248,4 @@ public override int GetHashCode() return base.GetHashCode(); } } +#endregion diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestEntry.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestEntry.cs index f6f5d23e0b..1eaa8defa4 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestEntry.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestEntry.cs @@ -93,6 +93,9 @@ public override int GetHashCode() return ExecutionId.GetHashCode(); } + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -116,4 +119,5 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter helper.SaveIEnumerable(TestEntries, element, "TestEntries", ".", "TestEntry", parameters); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestId.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestId.cs index 27e6e5e06b..3b9de2a6e0 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestId.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestId.cs @@ -12,6 +12,7 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; using XML; +#region TestId /// /// Class that uniquely identifies a test. /// @@ -54,6 +55,9 @@ public TestId(Guid id) /// public Guid Id { get; } + + #region IXmlTestStore Members + /// /// Saves the state to the XML element /// @@ -93,6 +97,12 @@ private void GetIdLocation(XmlTestStoreParameters parameters, out string idLocat } } + #endregion + + #region Equality + + #region IEquatable Members + /// /// Compares this instance with the other test ID for value equality /// @@ -115,6 +125,10 @@ private bool ValueEquals(TestId other) return other is not null && Id == other.Id; } + #endregion + + #region Overrides + /// /// Compares this instance with the other test ID for value equality /// @@ -134,6 +148,10 @@ public override int GetHashCode() return Id.GetHashCode(); } + #endregion + + #region Operators + /// /// Compares the two test IDs for value equality /// @@ -158,6 +176,14 @@ public override int GetHashCode() return !(left == right); } + #endregion + + #endregion + + #region Comparison + + #region IComparable Members + /// /// Compares this instance with the other test ID /// @@ -171,6 +197,10 @@ public int CompareTo(TestId other) return other == null ? throw new ArgumentNullException(nameof(other)) : Id.CompareTo(other.Id); } + #endregion + + #region IComparable Members + /// /// Compares this instance with the other test ID /// @@ -184,6 +214,12 @@ public int CompareTo(object other) return CompareTo(other as TestId); } + #endregion + + #endregion + + #region Overrides + /// /// Override ToString /// @@ -197,4 +233,6 @@ public override string ToString() return string.Format(CultureInfo.InvariantCulture, s); } + #endregion } +#endregion TestId diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestListCategory.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestListCategory.cs index bf813e2169..b9fe89cb30 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestListCategory.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestListCategory.cs @@ -129,6 +129,9 @@ public TestListCategoryId ParentCategoryId } } + + #region Overrides + /// /// Override function for Equals. /// @@ -159,6 +162,10 @@ public override int GetHashCode() { return Id.GetHashCode(); } + #endregion + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -177,4 +184,5 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter h.SaveGuid(element, "@parentListId", ParentCategoryId.Id); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestMethod.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestMethod.cs index 25ac9be8b7..c0af63b5c4 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestMethod.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestMethod.cs @@ -37,6 +37,8 @@ public TestMethod(string name, string className) /// public bool IsValid { get; set; } + #region Override + /// /// Override function for Equals. /// @@ -63,6 +65,10 @@ public override int GetHashCode() return Name?.GetHashCode() ?? 0; } + #endregion Override + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -80,4 +86,5 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) helper.SaveSimpleField(element, "isValid", IsValid, false); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs index 9233f13d8f..4622b88220 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestResult.cs @@ -62,6 +62,9 @@ public TestResultId(Guid runId, Guid executionId, Guid parentExecutionId, Guid t /// public Guid TestId { get; } + + #region Overrides + /// /// Override function for Equals /// @@ -97,6 +100,10 @@ public override string ToString() { return ExecutionId.ToString("B"); } + #endregion + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -118,6 +125,7 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter helper.SaveGuid(element, "@testId", TestId); } + #endregion } /// @@ -150,6 +158,8 @@ public string StackTrace set { _stackTrace = value; } } + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -164,6 +174,7 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter XmlPersistence.SaveUsingReflection(element, this, typeof(TestResultErrorInfo), parameters); } + #endregion } /// @@ -390,6 +401,8 @@ public string TestResultsDirectory /// public string ResultType { get; set; } + + #region Overrides public override bool Equals(object obj) { if (obj is not TestResult trm) @@ -407,6 +420,8 @@ public override int GetHashCode() return Id.GetHashCode(); } + #endregion + /// /// Helper function to add a text message info to the test result /// @@ -464,6 +479,8 @@ internal void AddCollectorDataEntries(IEnumerable collectorD } + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -509,6 +526,8 @@ public virtual void Save(System.Xml.XmlElement element, XmlTestStoreParameters p helper.SaveSimpleField(element, "@resultType", ResultType, string.Empty); } + #endregion + private void Initialize() { _textMessages = new ArrayList(); diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunConfiguration.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunConfiguration.cs index d406e45f87..4f7fe40c64 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunConfiguration.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunConfiguration.cs @@ -48,6 +48,8 @@ internal TestRunConfiguration(string name, TrxFileHelper trxFileHelper) _trxFileHelper = trxFileHelper; } + #region IXmlTestStoreCustom Members + /// /// Gets the element name. /// @@ -70,6 +72,8 @@ public string NamespaceUri } } + #endregion + /// /// Gets directory that receives reverse-deployed files from Controller. /// @@ -101,6 +105,8 @@ internal string RunDeploymentRootDirectory } } + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -149,4 +155,5 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) } } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs index 29c695e258..e22ecd967b 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestRunSummary.cs @@ -126,6 +126,9 @@ public TestRunSummary( _collectorDataEntries = dataCollectors; } + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -144,4 +147,5 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) helper.SaveIEnumerable(_collectorDataEntries, element, "CollectorDataEntries", ".", "Collector", parameters); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestType.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestType.cs index 44d4f6f3b3..c97e287e3f 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestType.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/TestType.cs @@ -43,6 +43,8 @@ public override int GetHashCode() return _typeId.GetHashCode(); } + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement.. /// @@ -57,4 +59,5 @@ public void Save(System.Xml.XmlElement element, XmlTestStoreParameters parameter XmlPersistence.SaveUsingReflection(element, this, null, parameters); } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/UriDataAttachment.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/UriDataAttachment.cs index 76a82f0f42..ab93ab0d6f 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/UriDataAttachment.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/UriDataAttachment.cs @@ -40,6 +40,8 @@ public UriDataAttachment(string description, Uri uri, TrxFileHelper trxFileHelpe Initialize(description, uri); } + #region IDataAttachment Members + /// /// Gets short description for the attachment. /// @@ -50,6 +52,10 @@ public UriDataAttachment(string description, Uri uri, TrxFileHelper trxFileHelpe /// public Uri Uri { get; private set; } + #endregion + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement. /// @@ -76,6 +82,10 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) helper.SaveSimpleField(element, "@href", Uri.OriginalString, null); } + #endregion + + #region Internal Methods + /// /// Clones the instance and makes the URI in the clone absolute using the specified base directory /// @@ -99,6 +109,7 @@ internal UriDataAttachment Clone(string baseDirectory, bool useAbsoluteUri) return this; } + #endregion private void Initialize(string desc, Uri uri) { EqtAssert.ParameterNotNull(desc, nameof(desc)); diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/WorkItems.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/WorkItems.cs index 2a31286b30..ca60360245 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/WorkItems.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/ObjectModel/WorkItems.cs @@ -12,6 +12,7 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.ObjectModel; using XML; +#region WorkItem /// /// Stores an int which represents a workitem /// @@ -40,6 +41,8 @@ public int Id } } + + #region Methods - overrides /// /// Compare the values of the items /// @@ -67,6 +70,10 @@ public override string ToString() { return _id.ToString(CultureInfo.InvariantCulture); } + #endregion + + #region IXmlTestStore Members + /// /// Saves the class under the XmlElement. /// @@ -77,7 +84,11 @@ public void Save(XmlElement element, XmlTestStoreParameters parameters) new XmlPersistence().SaveSingleFields(element, this, parameters); } + #endregion } +#endregion + +#region WorkItemCollection /// /// A collection of ints represent the workitems /// @@ -211,3 +222,4 @@ public override void Save(XmlElement element, XmlTestStoreParameters parameters) xmlPersistence.SaveHashtable(_container, element, ".", ".", null, "Workitem", parameters); } } +#endregion diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs index c609ecf6f8..102ec43dc6 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/TrxLogger.cs @@ -92,6 +92,9 @@ internal TrxLogger(IFileHelper fileHelper, TrxFileHelper trxFileHelper) /// private string _testResultsDirPath; + + #region ITestLogger + /// public void Initialize(TestLoggerEvents events!!, string testResultsDirPath) { @@ -132,6 +135,10 @@ public void Initialize(TestLoggerEvents events, Dictionary param _parametersDictionary = parameters; Initialize(events, _parametersDictionary[DefaultLoggerParameterNames.TestRunDirectory]); } + #endregion + + #region ForTesting + internal string GetRunLevelInformationalMessage() { return _runLevelStdOut.ToString(); @@ -169,6 +176,10 @@ internal int TestEntryCount internal TrxLoggerObjectModel.TestOutcome TestResultOutcome { get; private set; } = TrxLoggerObjectModel.TestOutcome.Passed; + #endregion + + #region Event Handlers + /// /// Called when a test message is received. /// @@ -723,4 +734,5 @@ private TrxLoggerObjectModel.TestOutcome ChangeTestOutcomeIfNecessary(TrxLoggerO return outcome; } + #endregion } diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs index 1477bc80e1..011513bb91 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Collection.cs @@ -19,6 +19,7 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.Utility; /// internal class EqtBaseCollection : ICollection, IXmlTestStore { + #region private classes /// /// Wraps non-generic enumerator. /// @@ -57,6 +58,8 @@ public void Dispose() { } } + #endregion + protected Hashtable _container; private string _childElementName; @@ -83,6 +86,8 @@ protected EqtBaseCollection(EqtBaseCollection other) EqtAssert.ParameterNotNull(other, nameof(other)); _container = new Hashtable(other._container); } + + #region Methods: ICollection // TODO: Consider putting check for null to derived classes. public virtual void Add(T item) { @@ -148,6 +153,9 @@ public bool IsReadOnly { get { return false; } } + #endregion + + #region IEnumerable public virtual IEnumerator GetEnumerator() { return _container.Keys.GetEnumerator(); @@ -157,6 +165,10 @@ IEnumerator IEnumerable.GetEnumerator() { return new EqtBaseCollectionEnumerator(GetEnumerator()); } + #endregion + + #region IXmlTestStore Members + /// /// Default behavior is to create child elements with name same as name of type T. /// Does not respect IXmlTestStoreCustom. @@ -167,6 +179,8 @@ public virtual void Save(XmlElement element, XmlTestStoreParameters parameters) xmlPersistence.SaveHashtable(_container, element, ".", ".", null, ChildElementName, parameters); } + #endregion + private string ChildElementName { get diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs index bc0b72b066..31b8dfd69e 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/XML/XmlPersistence.cs @@ -28,6 +28,8 @@ namespace Microsoft.TestPlatform.Extensions.TrxLogger.XML; /// internal class XmlPersistence { + #region Types + /// /// The exception type that is thrown when a duplicate key is added to a hashtable or /// dictionary @@ -67,6 +69,8 @@ public object Key } + #endregion + /// This is how we persist date time except DateTime.MinValue. private const string DateTimePersistenceFormat = "yyyy'-'MM'-'ddTHH':'mm':'ss'.'fffffffzzz"; @@ -150,6 +154,8 @@ private XmlElement CreateRootElement(string name, string namespaceUri) return (XmlElement)dom.AppendChild(dom.CreateElement(_prefix, name, namespaceUri)); } + #region PublicSaveDataInTrx + /// /// Save single fields. /// @@ -366,6 +372,7 @@ public void SaveStringDictionary(StringDictionary dict, XmlElement element, stri } } + #region Lists /// /// Save list of object . /// @@ -436,6 +443,8 @@ public void SaveList(IList list, XmlElement element, string listXmlElement } } + #region Counters + public void SaveCounters(XmlElement xml, string location, int[] counters) { xml = (XmlElement)LocationToXmlNode(xml, location); @@ -450,12 +459,22 @@ public void SaveCounters(XmlElement xml, string location, int[] counters) } } + #endregion Counters + + #endregion List + internal static void SaveUsingReflection(XmlElement element, object instance, Type requestedType, XmlTestStoreParameters parameters) { XmlPersistence helper = new(); helper.SaveSingleFields(element, instance, requestedType, parameters); } + #endregion PublicSaveDataInTrx + + #region Utilities + + #region Optimization: Reflection caching + /// /// Updates the cache if needed and gets the field info collection /// @@ -508,6 +527,8 @@ FieldInfo reflectedFieldInfo in return toReturn; } + #endregion Optimization: Reflection caching + /// /// Convert dateTime to string. /// @@ -800,6 +821,10 @@ private string ProcessXPathQuery(string queryIn) return queryString; } + #endregion Utilities + + #region Types + private class NewElementCreateData { public string NamespaceUri { get; set; } @@ -833,4 +858,5 @@ internal FieldPersistenceInfo(FieldInfo fieldInfo) } } + #endregion } diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs index 54ab0c9973..e0675d1c4f 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/Common/RequestId.cs @@ -39,6 +39,9 @@ internal RequestId(Guid id) Id = id; } + + #region Overrides + /// /// Compares this instance with the provided object for value equality /// @@ -78,6 +81,12 @@ public override string ToString() return Id.ToString("B"); } + #endregion + + #region Interface implementations + + #region IEquatable Members + /// /// Compares this instance with the provided request ID for value equality /// @@ -92,6 +101,10 @@ public bool Equals(RequestId other) ); } + #endregion + + #region IComparable Members + /// /// Compares this instance with the provided request ID /// @@ -102,6 +115,10 @@ public int CompareTo(RequestId other) return other == null ? 1 : Id.CompareTo(other.Id); } + #endregion + + #region IComparable Members + /// /// Compares this instance with the provided object /// @@ -123,6 +140,12 @@ public int CompareTo(object obj) : Id.CompareTo(other.Id); } + #endregion + + #endregion + + #region Operators + /// /// Compares the two request IDs for value equality /// @@ -149,6 +172,7 @@ right is not null && return !(left == right); } + #endregion /// /// Gets the underlying GUID that represents the request ID /// diff --git a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/BaseTransferInformation.cs b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/BaseTransferInformation.cs index 4dc2bf30a7..d53c4e23fc 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/BaseTransferInformation.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/DataCollector/TransferInformation/BaseTransferInformation.cs @@ -25,11 +25,18 @@ protected BasicTransferInformation(DataCollectionContext context) Description = string.Empty; } + + #region Required Parameters. + /// /// Gets the data collection context the transfer will be associated with. /// public DataCollectionContext Context { get; private set; } + #endregion + + #region Optional Parameters. + /// /// Gets or sets a short description of the data being sent. /// @@ -79,4 +86,5 @@ protected internal abstract string FileName get; } + #endregion } diff --git a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs index 151954b485..976e912429 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs @@ -115,6 +115,9 @@ private TestProperty(string id, string label, string category, string descriptio [DataMember] public string ValueType { get; set; } + + #region IEquatable + /// public override int GetHashCode() { @@ -133,6 +136,8 @@ public bool Equals(TestProperty other) return (other != null) && (Id == other.Id); } + #endregion IEquatable + /// public override string ToString() { diff --git a/src/Microsoft.TestPlatform.Utilities/CodeCoverageRunSettingsProcessor.cs b/src/Microsoft.TestPlatform.Utilities/CodeCoverageRunSettingsProcessor.cs index 4b642fe348..e176aecfec 100644 --- a/src/Microsoft.TestPlatform.Utilities/CodeCoverageRunSettingsProcessor.cs +++ b/src/Microsoft.TestPlatform.Utilities/CodeCoverageRunSettingsProcessor.cs @@ -32,6 +32,8 @@ public CodeCoverageRunSettingsProcessor(XmlNode defaultSettingsRootNode) { _defaultSettingsRootNode = defaultSettingsRootNode ?? throw new ArgumentNullException(nameof(defaultSettingsRootNode), "Default settings root node is null."); } + + #region Public Interface /// /// Processes the current settings for the code coverage data collector. /// @@ -141,6 +143,8 @@ public XmlNode Process(XmlNode currentSettingsRootNode) return currentSettingsRootNode; } + #endregion + /// /// Selects the node from the current settings node using the given /// style path. If unable to select the requested node it adds diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Friends.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Friends.cs index caed48e700..a9db03174f 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Friends.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Friends.cs @@ -3,6 +3,13 @@ using System.Runtime.CompilerServices; +#region Product Assemblies + +#endregion + +#region Test Assemblies + [assembly: InternalsVisibleTo("TranslationLayer.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs index 5565379159..176b096c58 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/TestSession.cs @@ -78,6 +78,8 @@ protected virtual void Dispose(bool disposing) StopTestSession(); _disposed = true; } + + #region ITestSession /// [Obsolete("This API is not final yet and is subject to changes.", false)] public void AbortTestRun() @@ -294,6 +296,9 @@ public bool StopTestSession( TestSessionInfo = null; } } + #endregion + + #region ITestSessionAsync /// [Obsolete("This API is not final yet and is subject to changes.", false)] public async Task DiscoverTestsAsync( @@ -491,4 +496,5 @@ public async Task StopTestSessionAsync( TestSessionInfo = null; } } + #endregion } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs index f9a186a6df..2173cc9fa7 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleRequestSender.cs @@ -81,6 +81,9 @@ internal VsTestConsoleRequestSender( _testPlatformEventSource = testPlatformEventSource; } + + #region ITranslationLayerRequestSender + /// public int InitializeCommunication() { @@ -836,6 +839,8 @@ public void Dispose() _communicationManager?.StopServer(); } + #endregion + private bool HandShakeWithVsTestConsole() { var success = false; diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index b4ae54b202..c8a43a7ca8 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -136,6 +136,9 @@ internal VsTestConsoleWrapper( _sessionStarted = false; } + + #region IVsTestConsoleWrapper + /// public void StartSession() { @@ -557,6 +560,10 @@ public void EndSession() _sessionStarted = false; } + #endregion + + #region IVsTestConsoleWrapperAsync + /// public async Task StartSessionAsync() { @@ -979,6 +986,8 @@ public Task ProcessTestRunAttachmentsAsync( CancellationToken cancellationToken) => ProcessTestRunAttachmentsAsync(attachments, Enumerable.Empty(), processingSettings, isLastBatch, collectMetrics, testSessionEventsHandler, cancellationToken); + #endregion + private void EnsureInitialized() { if (!_vstestConsoleProcessManager.IsProcessInitialized()) diff --git a/src/datacollector/Friends.cs b/src/datacollector/Friends.cs index 53247c63ea..e4f067129f 100644 --- a/src/datacollector/Friends.cs +++ b/src/datacollector/Friends.cs @@ -3,5 +3,9 @@ using System.Runtime.CompilerServices; +#region Test Assemblies + [assembly: InternalsVisibleTo("datacollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] + +#endregion diff --git a/src/testhost.x86/Friends.cs b/src/testhost.x86/Friends.cs index 7a90f6681a..0c96abe6bd 100644 --- a/src/testhost.x86/Friends.cs +++ b/src/testhost.x86/Friends.cs @@ -3,5 +3,12 @@ using System.Runtime.CompilerServices; +#region Product Assemblies + +#endregion + +#region Test Assemblies + [assembly: InternalsVisibleTo("testhost.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] +#endregion diff --git a/src/vstest.console/Friends.cs b/src/vstest.console/Friends.cs index 72d2a5f1ea..9b2a48fabe 100644 --- a/src/vstest.console/Friends.cs +++ b/src/vstest.console/Friends.cs @@ -3,7 +3,14 @@ using System.Runtime.CompilerServices; +#region Product Assemblies + +#endregion + +#region Test Assemblies + [assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("vstest.console.PlatformTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +#endregion diff --git a/src/vstest.console/Internal/ConsoleLogger.cs b/src/vstest.console/Internal/ConsoleLogger.cs index e68355b708..b24a370120 100644 --- a/src/vstest.console/Internal/ConsoleLogger.cs +++ b/src/vstest.console/Internal/ConsoleLogger.cs @@ -157,6 +157,9 @@ protected static IOutput Output /// private ConcurrentDictionary LeafTestResults { get; set; } + + #region ITestLoggerWithParameters + /// /// Initializes the Test Logger. /// @@ -219,6 +222,8 @@ public void Initialize(TestLoggerEvents events, Dictionary param Initialize(events, String.Empty); } + #endregion + /// /// Prints the timespan onto console. /// diff --git a/src/vstest.console/Processors/DisableAutoFakesArgumentProcessor.cs b/src/vstest.console/Processors/DisableAutoFakesArgumentProcessor.cs index 09a8d7913c..2a275fbee1 100644 --- a/src/vstest.console/Processors/DisableAutoFakesArgumentProcessor.cs +++ b/src/vstest.console/Processors/DisableAutoFakesArgumentProcessor.cs @@ -62,6 +62,9 @@ public DisableAutoFakesArgumentExecutor(CommandLineOptions commandLineOptions) { _commandLineOptions = commandLineOptions; } + + #region IArgumentProcessor + /// /// Initializes with the argument that was provided with the command. /// @@ -93,4 +96,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs b/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs index 15c6be8726..f207df710f 100644 --- a/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableBlameArgumentProcessor.cs @@ -130,6 +130,9 @@ internal EnableBlameArgumentExecutor(IRunSettingsProvider runSettingsManager, IE internal IOutput Output { get; set; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -373,4 +376,5 @@ private void AddCollectHangDumpNode(Dictionary parameters, XmlDo outernode.AppendChild(dumpNode); } + #endregion } diff --git a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs index 0456d9bfb0..234488247e 100644 --- a/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableCodeCoverageArgumentProcessor.cs @@ -101,6 +101,8 @@ internal class EnableCodeCoverageArgumentExecutor : IArgumentExecutor private static readonly string XPathSeperator = "/"; private static readonly string[] NodeNames = new string[] { Constants.RunSettingsName, Constants.DataCollectionRunSettingsName, Constants.DataCollectorsSettingName, Constants.DataCollectorSettingName }; + #region Default CodeCoverage Settings String + private static readonly string CodeCoverageCollectorSettingsTemplate = @" " + Environment.NewLine + @" " + Environment.NewLine + @@ -179,6 +181,8 @@ internal class EnableCodeCoverageArgumentExecutor : IArgumentExecutor @" " + Environment.NewLine + @" "; + #endregion + internal EnableCodeCoverageArgumentExecutor(CommandLineOptions options, IRunSettingsProvider runSettingsManager, IFileHelper fileHelper) { _commandLineOptions = options; diff --git a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs index 09bd9b2f7b..9b9096c310 100644 --- a/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableDiagArgumentProcessor.cs @@ -123,6 +123,9 @@ public EnableDiagArgumentExecutor(IFileHelper fileHelper) _fileHelper = fileHelper; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -248,4 +251,5 @@ private void CreateDirectoryIfNotExists(string filePath) } } + #endregion } diff --git a/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs b/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs index 20a8623a8e..9cbc487f31 100644 --- a/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs +++ b/src/vstest.console/Processors/EnableLoggerArgumentProcessor.cs @@ -123,6 +123,9 @@ public EnableLoggerArgumentExecutor(IRunSettingsProvider runSettingsManager) _runSettingsManager = runSettingsManager; } + + #region IArgumentProcessor + /// /// Initializes with the argument that was provided with the command. /// @@ -167,4 +170,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/FrameworkArgumentProcessor.cs b/src/vstest.console/Processors/FrameworkArgumentProcessor.cs index 19a49ea2ab..9fc7f9394f 100644 --- a/src/vstest.console/Processors/FrameworkArgumentProcessor.cs +++ b/src/vstest.console/Processors/FrameworkArgumentProcessor.cs @@ -112,6 +112,9 @@ public FrameworkArgumentExecutor(CommandLineOptions options, IRunSettingsProvide _runSettingsManager = runSettingsManager; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -157,4 +160,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/HelpArgumentProcessor.cs b/src/vstest.console/Processors/HelpArgumentProcessor.cs index 4201036611..bf3c27e94e 100644 --- a/src/vstest.console/Processors/HelpArgumentProcessor.cs +++ b/src/vstest.console/Processors/HelpArgumentProcessor.cs @@ -107,6 +107,9 @@ public HelpArgumentExecutor() /// internal IOutput Output { get; set; } + + #region IArgumentExecutor Members + public void Initialize(string argument) { } @@ -148,6 +151,7 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Abort; } + #endregion /// /// Lookup the help description for the argument processor. /// diff --git a/src/vstest.console/Processors/InIsolationArgumentProcessor.cs b/src/vstest.console/Processors/InIsolationArgumentProcessor.cs index 8dde6a687b..1e3afad377 100644 --- a/src/vstest.console/Processors/InIsolationArgumentProcessor.cs +++ b/src/vstest.console/Processors/InIsolationArgumentProcessor.cs @@ -101,6 +101,9 @@ public InIsolationArgumentExecutor(CommandLineOptions options, IRunSettingsProvi _commandLineOptions = options; _runSettingsManager = runSettingsManager; } + + #region IArgumentProcessor + /// /// Initializes with the argument that was provided with the command. /// @@ -127,4 +130,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs b/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs index ebc30e6727..fe5be232f0 100644 --- a/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListExtensionsArgumentProcessor.cs @@ -83,6 +83,7 @@ public Lazy Metadata } } +#region List discoverers /// /// Argument Executor for the "/ListDiscoverers" command line argument. /// @@ -117,6 +118,9 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } } +#endregion + +#region List executors /// /// Argument Executor for the "/ListExecutors" command line argument. /// @@ -150,6 +154,9 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } } +#endregion + +#region List loggers /// /// Argument Executor for the "/ListLoggers" command line argument. /// @@ -191,6 +198,9 @@ public void SendMessage(TestMessageLevel testMessageLevel, string message) } } } +#endregion + +#region List settings providers /// /// Argument Executor for the "/ListSettingsProviders" command line argument. /// @@ -224,3 +234,4 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } } +#endregion diff --git a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs index 9ec0ef3674..0c70a15845 100644 --- a/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListFullyQualifiedTestsArgumentProcessor.cs @@ -170,6 +170,9 @@ internal ListFullyQualifiedTestsArgumentExecutor( _discoveryEventsRegistrar = new DiscoveryEventsRegistrar(output, _testCasefilter, _discoveredTests, _commandLineOptions); } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -217,6 +220,8 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion + private class DiscoveryEventsRegistrar : ITestDiscoveryEventsRegistrar { private readonly IOutput _output; diff --git a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs index f6a3f6c57c..46b4348ea0 100644 --- a/src/vstest.console/Processors/ListTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListTestsArgumentProcessor.cs @@ -167,6 +167,9 @@ internal ListTestsArgumentExecutor( _discoveryEventsRegistrar = new DiscoveryEventsRegistrar(output); } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -208,6 +211,8 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion + private class DiscoveryEventsRegistrar : ITestDiscoveryEventsRegistrar { private readonly IOutput _output; diff --git a/src/vstest.console/Processors/ListTestsTargetPathArgumentProcessor.cs b/src/vstest.console/Processors/ListTestsTargetPathArgumentProcessor.cs index 827f45e08e..30b64aa2ec 100644 --- a/src/vstest.console/Processors/ListTestsTargetPathArgumentProcessor.cs +++ b/src/vstest.console/Processors/ListTestsTargetPathArgumentProcessor.cs @@ -88,6 +88,9 @@ public ListTestsTargetPathArgumentExecutor(CommandLineOptions options) Contract.Requires(options != null); _commandLineOptions = options; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -111,4 +114,5 @@ public ArgumentProcessorResult Execute() { return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/ParallelArgumentProcessor.cs b/src/vstest.console/Processors/ParallelArgumentProcessor.cs index 09a09b2af2..1b0e4bff20 100644 --- a/src/vstest.console/Processors/ParallelArgumentProcessor.cs +++ b/src/vstest.console/Processors/ParallelArgumentProcessor.cs @@ -108,6 +108,9 @@ public ParallelArgumentExecutor(CommandLineOptions options, IRunSettingsProvider _runSettingsManager = runSettingsManager; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -134,4 +137,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/PlatformArgumentProcessor.cs b/src/vstest.console/Processors/PlatformArgumentProcessor.cs index e86bc8130c..b836e96d57 100644 --- a/src/vstest.console/Processors/PlatformArgumentProcessor.cs +++ b/src/vstest.console/Processors/PlatformArgumentProcessor.cs @@ -112,6 +112,9 @@ public PlatformArgumentExecutor(CommandLineOptions options, IRunSettingsProvider _runSettingsManager = runSettingsManager; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -161,4 +164,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/PortArgumentProcessor.cs b/src/vstest.console/Processors/PortArgumentProcessor.cs index 7cd40036ac..0eaadf60fa 100644 --- a/src/vstest.console/Processors/PortArgumentProcessor.cs +++ b/src/vstest.console/Processors/PortArgumentProcessor.cs @@ -151,6 +151,9 @@ internal PortArgumentExecutor(CommandLineOptions options, ITestRequestManager te _processHelper = processHelper; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -185,6 +188,8 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion + private static IDesignModeClient InitializeDesignMode(int parentProcessId, IProcessHelper processHelper) { if (parentProcessId > 0) diff --git a/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs b/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs index 994e629a7b..77d7ec7e3b 100644 --- a/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs +++ b/src/vstest.console/Processors/ResultsDirectoryArgumentProcessor.cs @@ -116,6 +116,9 @@ public ResultsDirectoryArgumentExecutor(CommandLineOptions options, IRunSettings _runSettingsManager = runSettingsManager; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -155,4 +158,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs index d882efbb58..15e1828c0e 100644 --- a/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs +++ b/src/vstest.console/Processors/RunSpecificTestsArgumentProcessor.cs @@ -168,6 +168,9 @@ public RunSpecificTestsArgumentExecutor( _testRunEventsRegistrar = new TestRunRequestEventsRegistrar(Output, _commandLineOptions, artifactProcessingManager); } + + #region IArgumentProcessor + /// /// Splits given the search strings and adds to selectTestNamesCollection. /// @@ -220,6 +223,7 @@ public ArgumentProcessorResult Execute() return treatNoTestsAsError && _selectedTestCases.Count == 0 ? ArgumentProcessorResult.Fail : ArgumentProcessorResult.Success; } + #endregion /// /// Discovers tests from the given sources and selects only specified tests. /// diff --git a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs index b419ba5fa5..18bdefb83e 100644 --- a/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestAdapterPathArgumentProcessor.cs @@ -118,6 +118,9 @@ public TestAdapterPathArgumentExecutor(CommandLineOptions options, IRunSettingsP _fileHelper = fileHelper; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -201,4 +204,5 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/TestCaseFilterArgumentProcessor.cs b/src/vstest.console/Processors/TestCaseFilterArgumentProcessor.cs index 4e589e4e8e..17150524b1 100644 --- a/src/vstest.console/Processors/TestCaseFilterArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestCaseFilterArgumentProcessor.cs @@ -101,6 +101,9 @@ public TestCaseFilterArgumentExecutor(CommandLineOptions options) Contract.Requires(options != null); _commandLineOptions = options; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -134,4 +137,5 @@ public ArgumentProcessorResult Execute() { return ArgumentProcessorResult.Success; } + #endregion } diff --git a/src/vstest.console/Processors/TestSourceArgumentProcessor.cs b/src/vstest.console/Processors/TestSourceArgumentProcessor.cs index 06af80fd71..0aaeab100f 100644 --- a/src/vstest.console/Processors/TestSourceArgumentProcessor.cs +++ b/src/vstest.console/Processors/TestSourceArgumentProcessor.cs @@ -94,6 +94,9 @@ public TestSourceArgumentExecutor(CommandLineOptions testSources) _testSources = testSources; } + + #region IArgumentExecutor + /// /// Initializes with the argument that was provided with the command. /// @@ -116,4 +119,6 @@ public ArgumentProcessorResult Execute() return ArgumentProcessorResult.Success; } + #endregion + } diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 9187d0ee84..d2fc97dc1f 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -135,6 +135,8 @@ public static ITestRequestManager Instance } } + #region ITestRequestManager + /// public void InitializeExtensions( IEnumerable pathToAdditionalExtensions, @@ -582,6 +584,8 @@ public void CancelTestRunAttachmentsProcessing() _currentAttachmentsProcessingCancellationTokenSource?.Cancel(); } + #endregion + public void Dispose() { Dispose(true); diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs index de6e4953a9..57900e0bf3 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/RunsettingsTests.cs @@ -17,6 +17,7 @@ namespace Microsoft.TestPlatform.AcceptanceTests; [TestCategory("Windows-Review")] public class RunsettingsTests : AcceptanceTestBase { + #region Runsettings precedence tests /// /// Command line run settings should have high precedence among settings file, cli runsettings and cli switches /// @@ -114,6 +115,8 @@ public void CommandLineSwitchesShouldWinBetweenSettingsFileAndCommandLineSwitche RunTestWithRunSettings(runConfigurationDictionary, null, additionalArgs, testhostProcessName, expectedNumOfProcessCreated); } + #endregion + [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -255,6 +258,8 @@ public void TestAdapterPathFromRunSettings(RunnerInfo runnerInfo) ValidateSummaryStatus(1, 1, 1); } + #region LegacySettings Tests + [TestMethod] [TestCategory("Windows-Review")] [NetFullTargetFrameworkDataSource(inIsolation: true, useCoreRunner: false)] @@ -438,6 +443,10 @@ public void LegacySettingsAssemblyResolution(RunnerInfo runnerInfo) ValidateSummaryStatus(1, 0, 0); } + #endregion + + #region RunSettings With EnvironmentVariables Settings Tests + [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] @@ -467,6 +476,9 @@ public void EnvironmentVariablesSettingsShouldSetEnvironmentVariables(RunnerInfo ValidateSummaryStatus(1, 0, 0); } + #endregion + + #region RunSettings defined in project file /// /// RunSettingsFilePath can be specified in .csproj and should be honored by `dotnet test`, this test /// checks that the settings were honored by translating an inconclusive test to failed "result", instead of the default "skipped". @@ -497,6 +509,8 @@ public void RunSettingsAreLoadedFromProject(RunnerInfo runnerInfo) ValidateSummaryStatus(0, 0, 1); } + #endregion + private string GetRunsettingsFilePath(Dictionary runConfigurationDictionary, TempDirectory tempDirectory) { var runsettingsPath = Path.Combine(tempDirectory.Path, "test_" + Guid.NewGuid() + ".runsettings"); diff --git a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs index 5b16493083..a965cdc248 100644 --- a/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs +++ b/test/Microsoft.TestPlatform.AdapterUtilities.UnitTests/ManagedNameUtilities/ManagedNameRoundTripTests.cs @@ -821,6 +821,7 @@ public void Overloads18() managedMethodName: "Overload0`1(System.Tuple`1>>)"); } + #region Helpers private void VerifyRoundTrip( MethodInfo methodInfo, INamedTypeSymbol containingTypeSymbol, @@ -934,4 +935,5 @@ private void VerifyRoundTripFromName( // Assert.AreEqual(fullTypeName, roundTrippedFullTypeName); // Assert.AreEqual(fullMethodName, roundTrippedFullMethodName); // } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs index 6073e3f2f1..96838f7973 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestDiscoveryExtensionManagerTests.cs @@ -57,6 +57,8 @@ public void GetDiscoveryExtensionManagerShouldReturnADiscoveryManagerWithExtensi Assert.IsTrue(extensionManager.Discoverers.Any()); } + #region LoadAndInitialize tests + [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { @@ -72,6 +74,7 @@ public void LoadAndInitializeShouldInitializeAllExtensions() } } + #endregion } [TestClass] diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs index 4df1c73b67..0ef5ab768a 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestExecutorExtensionManagerTests.cs @@ -55,6 +55,8 @@ public void GetExecutorExtensionManagerShouldReturnAnExecutionManagerWithExtensi Assert.IsTrue(extensionManager.TestExtensions.Any()); } + #region LoadAndInitialize tests + [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { @@ -70,6 +72,7 @@ public void LoadAndInitializeShouldInitializeAllExtensions() } } + #endregion } [TestClass] diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs index a48a075bf8..9e21547c58 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginCacheTests.cs @@ -38,6 +38,8 @@ public TestPluginCacheTests() _mockFileHelper.Setup(fh => fh.DirectoryExists(It.IsAny())).Returns(true); } + #region Properties tests + [TestMethod] public void InstanceShouldNotReturnANull() { @@ -50,6 +52,10 @@ public void TestExtensionsShouldBeNullByDefault() Assert.IsNull(TestPluginCache.Instance.TestExtensions); } + #endregion + + #region UpdateAdditionalExtensions tests + [TestMethod] public void UpdateAdditionalExtensionsShouldNotThrowIfExtensionPathIsNull() { @@ -120,6 +126,10 @@ public void UpdateAdditionalExtensionsShouldResetExtensionsDiscoveredFlag() { } + #endregion + + #region ClearExtensions + [TestMethod] public void ClearExtensionsShouldClearPathToExtensions() { @@ -130,6 +140,10 @@ public void ClearExtensionsShouldClearPathToExtensions() Assert.AreEqual(0, TestPluginCache.Instance.GetExtensionPaths(string.Empty).Count); } + #endregion + + #region GetExtensionPaths + [TestMethod] public void GetExtensionPathsShouldConsolidateAllExtensions() { @@ -187,6 +201,10 @@ public void GetExtensionPathsShouldNotSkipDefaultExtensionsIfSetFalse() InvokeGetExtensionPaths(expectedExtensions, false); } + #endregion + + #region GetDefaultResolutionPaths tests + [TestMethod] public void GetDefaultResolutionPathsShouldReturnCurrentDirectoryByDefault() { @@ -237,6 +255,10 @@ public void GetDefaultResolutionPathsShouldReturnDirectoryFromDefaultExtensionsP Assert.IsTrue(resolutionPaths.Contains(Path.GetDirectoryName(defaultExtensionsFile))); } + #endregion + + #region GetResolutionPaths tests + [TestMethod] public void GetResolutionPathsShouldThrowIfExtensionAssemblyIsNull() { @@ -267,6 +289,10 @@ public void GetResolutionPathsShouldNotHaveDuplicatePathsIfExtensionIsInSameDire CollectionAssert.AreEqual(expectedPaths, resolutionPaths.ToList()); } + #endregion + + #region GetTestExtensions tests + [TestMethod] public void GetTestExtensionsShouldReturnExtensionsInAssembly() { @@ -314,6 +340,10 @@ public void GetTestExtensionsShouldShouldThrowIfDiscovererThrows() Assert.ThrowsException(() => _testablePluginCache.GetTestExtensions(extensionAssembly)); } + #endregion + + #region DiscoverTestExtensions tests + [TestMethod] public void DiscoverTestExtensionsShouldDiscoverExtensionsFromExtensionsFolder() { @@ -338,6 +368,8 @@ public void DiscoverTestExtensionsShouldSetCachedBoolToTrue() Assert.IsTrue(TestPluginCache.Instance.TestExtensions.AreTestExtensionsCached()); } + #endregion + private void InvokeGetExtensionPaths(List expectedExtensions, bool skipDefaultExtensions) { TestPluginCache.Instance.UpdateExtensions(new[] { @"filter.dll", @"other.dll" }, false); diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs index 538aa25eca..678e57e317 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs @@ -146,6 +146,10 @@ public void GetTestExtensionsInformationShouldNotAbortOnFaultyExtensions() Assert.That.DoesNotThrow(() => _testPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions)); } + #region Implementations + + #region Discoverers + private abstract class AbstractTestDiscoverer : ITestDiscoverer { public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) @@ -170,6 +174,10 @@ public void DiscoverTests(IEnumerable sources, IDiscoveryContext discove } } + #endregion + + #region Executors + [ExtensionUri("ValidExecutor")] private class ValidExecutor : ITestExecutor { @@ -227,6 +235,10 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame } } + #endregion + + #region Loggers + [ExtensionUri("csv")] private class ValidLogger : ITestLogger { @@ -254,6 +266,10 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) } } + #endregion + + #region Settings Providers + [SettingsName("ValidSettingsProvider")] private class ValidSettingsProvider : ISettingsProvider { @@ -281,6 +297,10 @@ public void Load(XmlReader reader) } } + #endregion + + #region DataCollectors + public class InvalidDataCollector : DataCollector { public override void Initialize( @@ -331,6 +351,8 @@ public Task> ProcessAttachmentSetsAsync(XmlElement co throw new NotImplementedException(); } } + #endregion + internal class FaultyTestExecutorPluginInformation : TestExtensionPluginInformation { /// @@ -342,4 +364,5 @@ public FaultyTestExecutorPluginInformation(Type type) : base(type) throw new Exception(); } } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs index 7465761b61..7f010866ac 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginManagerTests.cs @@ -120,6 +120,8 @@ public void GetTestExtensionsForAnExtensionAssemblyShouldReturnExtensionsInThatA Assert.IsTrue(testExtensions.Any()); } + #region Implementations + private abstract class AbstractDummyLogger : ITestLogger { public void Initialize(TestLoggerEvents events, string testRunDirectory) @@ -151,4 +153,5 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame } } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/LazyExtensionTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/LazyExtensionTests.cs index 9927e83745..ad1fba3d87 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/LazyExtensionTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/LazyExtensionTests.cs @@ -23,6 +23,8 @@ namespace TestPlatform.Common.UnitTests.ExtensionFramework.Utilities; [TestClass] public class LazyExtensionTests { + #region Value tests + [TestMethod] public void ValueShouldCreateExtensionViaTheCallback() { @@ -68,6 +70,10 @@ public void ValueShouldNotCreateExtensionIfAlreadyCreated() Assert.AreEqual(1, numberOfTimesExtensionCreated); } + #endregion + + #region metadata tests + [TestMethod] public void MetadataShouldReturnMetadataSpecified() { @@ -98,6 +104,10 @@ public void MetadataShouldCreateMetadataFromMetadataType() Assert.AreEqual(AssemblyType.Native, (metadata as ITestDiscovererCapabilities).AssemblyType); } + #endregion + + #region Implementation + private class DummyDiscovererCapability : ITestDiscovererCapabilities { public IEnumerable FileExtension @@ -137,4 +147,5 @@ public void DiscoverTests(IEnumerable sources, IDiscoveryContext discove } } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestDiscovererPluginInformationTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestDiscovererPluginInformationTests.cs index 7e3e3d1f2d..2c0d409ec8 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestDiscovererPluginInformationTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestDiscovererPluginInformationTests.cs @@ -134,6 +134,8 @@ public void MetadataShouldReturnFileExtensionsAndDefaultExecutorUriAndAssemblyTy } } +#region Implementation + public class DummyTestDiscovererWithNoFileExtensions { } @@ -192,3 +194,5 @@ public class DummyTestDiscovererWithOneFileExtensions public class DummyTestDiscovererWithTwoFileExtensions { } + +#endregion diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionPluginInformationTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionPluginInformationTests.cs index b8bf802c40..d197ad2916 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionPluginInformationTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestExtensionPluginInformationTests.cs @@ -56,6 +56,8 @@ public void MetadataShouldReturnExtensionUri() CollectionAssert.AreEqual(new object[] { DefaultExtensionUri }, _testPluginInformation.Metadata.ToArray()); } + #region Implementation + private class TestableTestExtensionPluginInformation : TestExtensionPluginInformation { public TestableTestExtensionPluginInformation(Type testExtensionType) : base(testExtensionType) @@ -72,4 +74,5 @@ private class DummyTestExtensionWithExtensionUri { } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestLoggerPluginInformationTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestLoggerPluginInformationTests.cs index c3729d9537..d9bc6d51ce 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestLoggerPluginInformationTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestLoggerPluginInformationTests.cs @@ -56,6 +56,8 @@ public void MetadataShouldReturnExtensionUriAndFriendlyName() CollectionAssert.AreEqual(new object[] { DefaultExtensionUri, DefaultFriendlyName }, _testPluginInformation.Metadata.ToArray()); } + #region Implementation + private class DummyTestExtensionWithNoFriendlyName { } @@ -66,4 +68,5 @@ private class DummyTestExtensionWithFriendlyName { } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestPluginInformationTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestPluginInformationTests.cs index 0c7a2292cf..9370c2ad8c 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestPluginInformationTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestPluginInformationTests.cs @@ -40,9 +40,13 @@ public void MetadataShouldReturnTestExtensionTypesAssemblyQualifiedName() } } +#region Implementation + public class TestableTestPluginInformation : TestPluginInformation { public TestableTestPluginInformation(Type testExtensionType) : base(testExtensionType) { } } + +#endregion diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestSettingsProviderPluginInformationTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestSettingsProviderPluginInformationTests.cs index 9e03cce0bd..e10e5d4fd5 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestSettingsProviderPluginInformationTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/Utilities/TestSettingsProviderPluginInformationTests.cs @@ -53,6 +53,8 @@ public void SettingsNameShouldReturnExtensionUriOfAnExtension() Assert.AreEqual(DefaultSettingsName, _testPluginInformation.SettingsName); } + #region Implementation + private class DummySettingProviderWithoutSettingsName { } @@ -62,4 +64,5 @@ private class DummySettingProviderWithSettingsName { } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs index 1fb92d08eb..ff02cb8a9d 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/Hosting/TestHostProviderManagerTests.cs @@ -149,6 +149,8 @@ public void TestHostProviderManagerShouldReturnNullIfTargetFrameworkIsPortable() Assert.IsNull(manager.GetTestHostManagerByRunConfiguration(runSettingsXml)); } + #region Implementations + [ExtensionUri("executor://DesktopTestHost")] [FriendlyName("DesktopTestHost")] private class CustomTestHost : ITestRuntimeProvider @@ -295,4 +297,5 @@ public IEnumerable GetTestSources(IEnumerable sources) } } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs index 7c5d8e22f5..c751c40bc1 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/RunSettingsTests.cs @@ -26,6 +26,8 @@ public void TestCleanup() TestSessionMessageLogger.Instance = null; } + #region LoadSettingsXML Tests + [TestMethod] public void LoadSettingsXmlShouldThrowOnNullSettings() { @@ -68,6 +70,10 @@ public void LoadSettingsXmlShouldThrowOnInvalidSettings() "An error occurred while loading the run settings."); } + #endregion + + #region InitializeSettingsProviders and GetSettings tests + [TestMethod] public void InitializeSettingsProvidersShouldThrowOnNullSettings() { @@ -198,6 +204,10 @@ public void InitializeSettingsProvidersShouldWarnOfDuplicateSettings() receivedWarningMessage); } + #endregion + + #region GetSettings tests + [TestMethod] public void GetSettingsShouldThrowIfSettingsNameIsNull() { @@ -215,6 +225,10 @@ public void GetSettingsShouldThrowIfSettingsNameIsEmpty() } // The remaining GetSettings tests are covered in the InitializeSettingsProviders tests above. + #endregion + + #region Private methods + private string GetEmptyRunSettings() { return @" @@ -283,6 +297,10 @@ private string GetInvalidRunSettings() "; } + #endregion + + #region Testable Implementations + [SettingsName("RunConfiguration")] private class RunConfigurationSettingsProvider : ISettingsProvider { @@ -316,4 +334,5 @@ public void Load(XmlReader reader) } } + #endregion } diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs index 345374f019..94c0a47a2d 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/SettingsProvider/SettingsProviderExtensionManagerTests.cs @@ -30,6 +30,8 @@ public void TestCleanup() SettingsProviderExtensionManager.Destroy(); } + #region Constructor tests + [TestMethod] public void ConstructorShouldPopulateSettingsProviderMap() { @@ -72,6 +74,10 @@ public void ConstructorShouldLogWarningOnDuplicateSettingsProviderNames() Assert.AreEqual("TestableSettings", spm.SettingsProvidersMap.Keys.FirstOrDefault()); } + #endregion + + #region Create tests + [TestMethod] public void CreateShouldDiscoverSettingsProviderExtensions() { @@ -95,6 +101,10 @@ public void CreateShouldCacheDiscoveredExtensions() Assert.IsTrue(extensionManager.SettingsProvidersMap.Count > 0); } + #endregion + + #region LoadAndInitialize tests + [TestMethod] public void LoadAndInitializeShouldInitializeAllExtensions() { @@ -110,6 +120,10 @@ public void LoadAndInitializeShouldInitializeAllExtensions() } } + #endregion + + #region GetSettingsProvider tests + [TestMethod] public void GetSettingsProviderShouldThrowIfSettingsNameIsNullOrEmpty() { @@ -164,6 +178,10 @@ public void GetSettingsProviderShouldReturnSettingsProviderInstance() Assert.IsNotNull(sp.Value); } + #endregion + + #region private methods + private IEnumerable> GetMockExtensions(params string[] settingNames) { var settingsList = new List>(); @@ -184,6 +202,10 @@ private IEnumerable(() => _tcpClient.ConnectAsync(IPAddress.Loopback, port).Wait()); } + #endregion + + #region Client tests + [TestMethod] public async Task SetupClientAsyncShouldConnectToServer() { @@ -168,6 +174,10 @@ public async Task StopClientShouldDisconnectClient() Assert.ThrowsException(() => WriteOnSocket(client.Client)); } + #endregion + + #region Message sender tests + [TestMethod] public async Task SendMessageShouldSendMessageWithoutAnyPayload() { @@ -208,6 +218,10 @@ public async Task SendMessageWithRawMessageShouldNotSerializeThePayload() Assert.AreEqual(DummyPayload, ReadFromStream(client.GetStream())); } + #endregion + + #region Message receiver tests + [TestMethod] public async Task ReceiveMessageShouldReceiveDeserializedMessage() { @@ -254,6 +268,8 @@ public async Task ReceiveRawMessageAsyncShouldNotDeserializeThePayload() Assert.AreEqual(DummyPayload, message); } + #endregion + [TestMethod] public void SocketPollShouldNotHangServerClientCommunication() { diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs index 62e0cd23ab..d50fd58fa2 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestCaseSerializationTests.cs @@ -30,6 +30,8 @@ public class TestCaseSerializationTests Traits = { new Trait("Priority", "0"), new Trait("Category", "unit") } }; + #region v1 Tests + [TestMethod] public void TestCaseJsonShouldContainAllPropertiesOnSerialization() { @@ -137,6 +139,10 @@ public void TestCasePropertiesShouldGetRegisteredAsPartOfDeserialization() VerifyDummyPropertyIsRegistered(); } + #endregion + + #region v2 Tests + [TestMethod] public void TestCaseJsonShouldContainAllPropertiesOnSerializationV2() { @@ -226,6 +232,10 @@ public void TestCasePropertiesShouldGetRegisteredAsPartOfDeserializationV2() VerifyDummyPropertyIsRegistered(); } + #endregion + + #region Common Tests + [TestMethod] [DataRow(1)] [DataRow(2)] @@ -243,6 +253,8 @@ public void TestCaseObjectShouldDeserializeTraitsWithSpecialCharacters(int versi Assert.AreEqual(@"SDJDDHW>,:&^%//\\\\", traits[0].Value); } + #endregion + private static string Serialize(T data, int version = 1) { return JsonDataSerializer.Instance.Serialize(data, version); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs index 0a55966376..a1e905c79f 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Serialization/TestResultSerializationTests.cs @@ -38,6 +38,8 @@ public class TestResultSerializationTests EndTime = DateTimeOffset.MaxValue }; + #region v1 serializer Tests (used with protocol 1 and accidentally with 3) + [TestMethod] [DataRow(1)] [DataRow(3)] @@ -180,6 +182,10 @@ public void TestResultPropertiesShouldGetRegisteredAsPartOfDeserialization(int v VerifyDummyPropertyIsRegistered(); } + #endregion + + #region v2 serializer Tests (used with protocol 2 and 4) + [TestMethod] [DataRow(2)] [DataRow(4)] @@ -268,6 +274,10 @@ public void TestResultPropertiesShouldGetRegisteredAsPartOfDeserializationV2(int VerifyDummyPropertyIsRegistered(); } + #endregion + + #region future + [TestMethod] public void TestResultSerializationShouldThrowWhenProvidedProtocolVersionDoesNotExist() { @@ -279,6 +289,8 @@ public void TestResultSerializationShouldThrowWhenProvidedProtocolVersionDoesNot Assert.ThrowsException(() => Serialize(TestResult, version)); } + #endregion + private static string Serialize(T data, int version) { return JsonDataSerializer.Instance.Serialize(data, version); diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs index b3286e6786..61606ea8bd 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs @@ -239,6 +239,8 @@ public void OnClientProcessExitShouldNotSendRawMessageIfOperationNotStarted() _mockExecutionEventsHandler.Verify(eh => eh.HandleRawMessage(It.IsAny()), Times.Never); } + #region Version Check Tests + [TestMethod] public void CheckVersionWithTestHostShouldSendHighestSupportedVersion() { @@ -284,6 +286,9 @@ public void CheckVersionWithTestHostShouldThrowIfProtocolNegotiationTimeouts() Assert.AreEqual(message, TimoutErrorMessage); } + #endregion + + #region Discovery Protocol Tests [TestMethod] public void InitializeDiscoveryShouldSendCommunicationMessageWithCorrectParameters() { @@ -476,6 +481,10 @@ public void DiscoverTestShouldNotifyDiscoveryCompleteIfClientDisconnected() _mockDiscoveryEventsHandler.Verify(eh => eh.HandleDiscoveryComplete(It.Is(dc => dc.IsAborted == true && dc.TotalCount == -1), null)); } + #endregion + + #region Execution Protocol Tests + [TestMethod] public void InitializeExecutionShouldSendCommunicationMessageWithCorrectParameters() { @@ -772,6 +781,8 @@ public void SendTestRunAbortShouldSendAbortTestRunMessage() _mockChannel.Verify(c => c.Send(It.IsAny()), Times.Once); } + #endregion + private string SetupFakeCommunicationChannel(string connectionArgs = "123") { _connectionInfo = new TestHostConnectionInfo diff --git a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs index b4777efdf5..d78fcb878f 100644 --- a/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs +++ b/test/Microsoft.TestPlatform.CoreUtilities.UnitTests/Utilities/JobQueueTests.cs @@ -398,6 +398,8 @@ public void TestDisposeUnblocksBlockedThreads() queueThread.Join(); } + #region Implementation + /// /// a class that inherits from job queue and over rides the WaitForQueueToEmpty to allow for checking that blocking and /// unblocking work as expected. @@ -455,6 +457,10 @@ protected override bool WaitForQueueToGetEmpty() } } + #endregion + + #region Utility Methods + /// /// Returns a job processing handler which does nothing. /// @@ -469,4 +475,5 @@ private static Action GetEmptyProcessHandler() return handler; } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Adapter/TestExecutionRecorderTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Adapter/TestExecutionRecorderTests.cs index 9ef3667563..1d7f73cb93 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Adapter/TestExecutionRecorderTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Adapter/TestExecutionRecorderTests.cs @@ -110,6 +110,7 @@ public void RecordAttachmentsShouldAddToAttachmentSetForMultipleAttachments() CollectionAssert.AreEqual(attachmentSet, attachments); } + #region TestCaseResult caching tests. [TestMethod] public void RecordStartShouldInvokeSendTestCaseStart() { @@ -221,4 +222,5 @@ public void RecordResultShouldSendTestCaseEndEventIfRecordEndWasNotCalled() Assert.IsTrue(_testableTestRunCache.TestResultList.Contains(_testResult)); } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DataCollectionTestRunEventsHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DataCollectionTestRunEventsHandlerTests.cs index 3d22130ff7..beb32d7cf7 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DataCollectionTestRunEventsHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/DataCollection/DataCollectionTestRunEventsHandlerTests.cs @@ -140,6 +140,7 @@ public void HandleRawMessageShouldInvokeAfterTestRunEndAndReturnInvokedDataColle Times.Once); } + #region Get Combined Attachments [TestMethod] public void GetCombinedAttachmentSetsShouldReturnCombinedAttachments() { @@ -181,4 +182,5 @@ public void GetCombinedAttachmentSetsShouldReturnNullIfFirstArgumentIsNull() Assert.IsNull(result); } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs index 29aea3e1b7..565cfd0c3b 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscovererEnumeratorTests.cs @@ -618,6 +618,8 @@ private void InvokeLoadTestWithMockSetup() _discovererEnumerator.LoadTests(extensionSourceMap, _runSettingsMock.Object, null, _messageLoggerMock.Object); } + #region Implementation + /// /// Placing this before others so that at runtime this would be the first to be discovered as a discoverer. /// @@ -774,4 +776,5 @@ public static void Reset() } } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs index 241c751d09..741e7157bf 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Discovery/DiscoveryManagerTests.cs @@ -51,6 +51,8 @@ public void TestCleanup() TestPluginCache.Instance = null; } + #region Initialize tests + [TestMethod] public void InitializeShouldUpdateAdditionalExtenions() { @@ -68,6 +70,10 @@ public void InitializeShouldUpdateAdditionalExtenions() Assert.IsTrue(allDiscoverers.Any()); } + #endregion + + #region DiscoverTests tests + [TestMethod] public void DiscoverTestsShouldLogIfTheSourceDoesNotExist() { @@ -262,4 +268,5 @@ public void DiscoveryInitializeShouldVerifyWarningMessageIfAdapterFailedToLoad() mockLogger.Verify(rd => rd.HandleLogMessage(TestMessageLevel.Warning, "verify that the HandleLogMessage method getting invoked at least once"), Times.Once); } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs index 4a7bcd58aa..4cdd5ae863 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/EventHandlers/TestRequestHandlerTests.cs @@ -135,6 +135,8 @@ public void ProcessRequestsShouldProcessMessagesUntilSessionCompleted() Assert.IsTrue(task.Wait(2000)); } + #region Version Check Protocol + [TestMethod] public void ProcessRequestsVersionCheckShouldAckMinimumOfGivenAndHighestSupportedVersion() { @@ -165,6 +167,10 @@ public void ProcessRequestsVersionCheckShouldLogErrorIfDiagnosticsEnableFails() SendSessionEnd(); } + #endregion + + #region Discovery Protocol + [TestMethod] public void ProcessRequestsDiscoveryInitializeShouldSetExtensionPaths() { @@ -205,6 +211,10 @@ public void DiscoveryCompleteShouldSendDiscoveryCompletePayloadOnChannel() SendSessionEnd(); } + #endregion + + #region Execution Protocol + [TestMethod] public void ProcessRequestsExecutionInitializeShouldSetExtensionPaths() { @@ -378,6 +388,9 @@ public void LaunchProcessWithDebuggerAttachedShouldWaitForProcessIdFromRunner() Assert.AreEqual(123, task.Result); } + #endregion + + #region Logging Protocol [TestMethod] public void SendLogShouldSendTestMessageWithLevelOnChannel() { @@ -397,6 +410,8 @@ public void SendLogShouldSendTestMessageWithLevelOnChannel() SendSessionEnd(); } + #endregion + [TestMethod] public void ProcessRequestsEndSessionShouldCloseRequestHandler() { diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs index 9dd664b72f..7bd5b3adb7 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/BaseRunTestsTests.cs @@ -106,6 +106,8 @@ public void Cleanup() TestPluginCacheHelper.ResetExtensionsCache(); } + #region Constructor tests + [TestMethod] public void ConstructorShouldInitializeRunContext() { @@ -131,6 +133,10 @@ public void ConstructorShouldInitializeExecutorUrisThatRanTests() Assert.IsNotNull(executorUris); } + #endregion + + #region RunTests tests + [TestMethod] public void RunTestsShouldRaiseTestRunCompleteWithAbortedAsTrueOnException() { @@ -769,6 +775,10 @@ public void CancelShouldCreateStaThreadIfExecutionThreadApartmentStateIsSta() "Both RunTests() and Cancel() should create STA thread."); } + #endregion + + #region Private Methods + private void SetupExecutorUriMock() { var executorUriExtensionMap = new List> @@ -903,6 +913,10 @@ private void SetupHandleTestRunComplete() }); } + #endregion + + #region Testable Implementation + private class TestableBaseRunTests : BaseRunTests { public TestableBaseRunTests( @@ -1040,4 +1054,6 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame } } + #endregion + } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs index 37a2bad533..ed107d2e2e 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/ExecutionManagerTests.cs @@ -250,6 +250,10 @@ public void InitializeShouldVerifyTheHandlerInitializationWhenAdapterIsFailedToL mockLogger.Verify(rd => rd.HandleLogMessage(It.IsAny(), "verify that the HandleLogMessage method will not be invoked when handler is not initialized"), Times.Never); } + #region Implementations + + #region Discoverers + private abstract class AbstractTestDiscoverer : ITestDiscoverer { public void DiscoverTests(IEnumerable sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink) @@ -274,6 +278,10 @@ public void DiscoverTests(IEnumerable sources, IDiscoveryContext discove } } + #endregion + + #region Executors + [ExtensionUri("ValidExecutor")] private class ValidExecutor : ITestExecutor { @@ -331,6 +339,10 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame } } + #endregion + + #region Loggers + [ExtensionUri("csv")] private class ValidLogger : ITestLogger { @@ -358,6 +370,10 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory) } } + #endregion + + #region Settings Providers + [SettingsName("ValidSettingsProvider")] private class ValidSettingsProvider : ISettingsProvider { @@ -385,6 +401,10 @@ public void Load(XmlReader reader) } } + #endregion + + #region DataCollectors + public class InvalidDataCollector : DataCollector { public override void Initialize( @@ -421,6 +441,8 @@ public override void Initialize( } } + #endregion + internal class FaultyTestExecutorPluginInformation : TestExtensionPluginInformation { /// @@ -432,4 +454,5 @@ public FaultyTestExecutorPluginInformation(Type type) : base(type) throw new Exception(); } } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs index 54fe53b2e0..956dbc1cf1 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithSourcesTests.cs @@ -338,6 +338,8 @@ private void SetupForNoTestsAvailable(string testCaseFilter, out string sourcesS _mockRequestData.Object); } + #region Testable Implementations + private class TestableRunTestsWithSources : RunTestsWithSources { public TestableRunTestsWithSources(Dictionary> adapterSourceMap, string runSettings, @@ -413,4 +415,5 @@ public void RunTests(IEnumerable tests, IRunContext runContext, IFrame } } + #endregion } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs index 62a2fa6356..feac386fd9 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/RunTestsWithTestsTests.cs @@ -195,6 +195,8 @@ public void SendSessionEndShouldCallSessionEnd() mockTestCaseEventsHandler.Verify(x => x.SendSessionEnd()); } + #region Testable Implementations + private class TestableRunTestsWithTests : RunTestsWithTests { public TestableRunTestsWithTests(IEnumerable testCases, @@ -236,4 +238,6 @@ public void CallSendSessionEnd() } } + #endregion + } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/TestRunCacheTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/TestRunCacheTests.cs index 3762b555de..62b4979dbd 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/TestRunCacheTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Execution/TestRunCacheTests.cs @@ -16,6 +16,8 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Execution; [TestClass] public class TestRunCacheBehaviors { + #region OnTestStarted tests + [TestMethod] public void OnTestStartedShouldAddToInProgressTests() { @@ -81,6 +83,10 @@ public void OnTestStartedShouldReportResultsOnCacheHit() Assert.AreEqual(2, tester.TotalInProgressTestsReceived); } + #endregion + + #region OnNewTestResult tests + [TestMethod] public void OnNewTestResultShouldAddToTotalExecutedTests() { @@ -204,6 +210,10 @@ public void OnNewTestResultShouldReportResultsMultipleTimes() Assert.AreEqual(5, cache.TestResults.Count); } + #endregion + + #region OnTestCompletion tests + [TestMethod] public void OnTestCompletionShouldNotThrowIfCompletedTestIsNull() { @@ -284,6 +294,10 @@ public void OnTestCompleteShouldNotRemoveTestCaseFromInProgressListForUnrelatedT Assert.AreEqual(1, cache.InProgressTests.Count); } + #endregion + + #region GetLastChunk tests + [TestMethod] public void GetLastChunkShouldReturnTestResultsInCache() { @@ -322,6 +336,10 @@ public void GetLastChunkShouldResetTestResultsInCache() Assert.AreEqual(0, cache.TestResults.Count); } + #endregion + + #region TestRunStasts tests + [TestMethod] public void TestRunStatsShouldReturnCurrentStats() { @@ -345,6 +363,10 @@ public void TestRunStatsShouldReturnCurrentStats() Assert.AreEqual(5, stats.Stats[TestOutcome.Failed]); } + #endregion + + #region Helpers + private Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult GetTestResult(int index) { var tc = new TestCase("Test" + index, new Uri("executor://dummy"), "DummySourceFileName"); @@ -376,4 +398,5 @@ public void CacheHitOnTimerLimit(ICollection(() => _htmlLogger.TestMessageHandler(new object(), default)); } + #endregion + [TestMethod] public void TestMessageHandlerShouldAddMessageWhenItIsInformation() { diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs index a2d7395f52..78cead76da 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Client/TestRunCriteriaTests.cs @@ -17,6 +17,8 @@ namespace Microsoft.TestPlatform.ObjectModel.UnitTests; [TestClass] public class TestRunCriteriaTests { + #region Constructor tests. + [TestMethod] public void ConstructorForSourcesShouldInitializeAdapterSourceMap() { @@ -56,6 +58,10 @@ public void ConstructorForSourcesWithAdapterSourceMapShouldInitializeSourceMap() CollectionAssert.AreEqual(sourceSet2, testRunCriteria.AdapterSourceMap.Values.ToArray()[1].ToList()); } + #endregion + + #region Sources tests. + [TestMethod] public void SourcesShouldEnumerateThroughAllSourcesInTheAdapterSourceMap() { @@ -83,6 +89,10 @@ public void SourcesShouldReturnNullIfAdapterSourceMapIsNull() Assert.IsNull(testRunCriteria.Sources); } + #endregion + + #region HasSpecificSources tests + [TestMethod] public void HasSpecificSourcesReturnsFalseIfSourcesAreNotSpecified() { @@ -103,6 +113,10 @@ public void HasSpecificSourcesReturnsTrueIfSourcesAreSpecified() Assert.IsTrue(testRunCriteria.HasSpecificSources); } + #endregion + + #region HasSpecificTests tests + [TestMethod] public void HasSpecificTestsReturnsTrueIfTestsAreSpecified() { @@ -123,6 +137,10 @@ public void HasSpecificTestsReturnsFalseIfSourcesAreSpecified() Assert.IsFalse(testRunCriteria.HasSpecificTests); } + #endregion + + #region TestCaseFilter tests + [TestMethod] public void TestCaseFilterSetterShouldSetFilterCriteriaForSources() { @@ -132,4 +150,5 @@ public void TestCaseFilterSetterShouldSetFilterCriteriaForSources() Assert.AreEqual("foo", testRunCriteria.TestCaseFilter); } + #endregion } diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestCaseTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestCaseTests.cs index 5a84e597fc..1307d64e28 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestCaseTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestCaseTests.cs @@ -64,6 +64,8 @@ public void TestCaseLocalExtensionDataIsPubliclySettableGettableProperty() Assert.AreEqual("foo", _testCase.LocalExtensionData); } + #region GetSetPropertyValue Tests + [TestMethod] public void TestCaseGetPropertyValueForCodeFilePathShouldReturnCorrectValue() { @@ -190,4 +192,5 @@ public void TestCaseSetPropertyValueForSourceShouldSetValue() Assert.AreEqual(testSource, _testCase.Source); } + #endregion } diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestResultTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestResultTests.cs index d4bf67f013..14f5c0bf08 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestResultTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/TestResultTests.cs @@ -42,6 +42,8 @@ public void TestResultShouldInitializeStartAndEndTimeToCurrent() Assert.IsTrue(_result.EndTime.Subtract(DateTimeOffset.UtcNow) < new TimeSpan(0, 0, 0, 10)); } + #region GetSetPropertyValue Tests + [TestMethod] public void TestResultGetPropertyValueForComputerNameShouldReturnCorrectValue() { @@ -186,4 +188,6 @@ public void TestResultSetPropertyValueForStartTimeShouldSetValue() Assert.AreEqual(testStartTime, _result.StartTime); } + #endregion + } diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs index 9b37dea928..67ca5d562d 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/Utilities/XmlRunSettingsUtilitiesTests.cs @@ -18,6 +18,8 @@ namespace Microsoft.TestPlatform.ObjectModel.UnitTests.Utilities; [TestClass] public class XmlRunSettingsUtilitiesTests { + #region Private Variables + private readonly string _runSettingsXmlWithDataCollectors = @" @@ -80,6 +82,10 @@ public class XmlRunSettingsUtilitiesTests private readonly string _emptyRunSettings = ""; + #endregion + + #region GetTestRunParameters tests + [TestMethod] public void GetTestRunParametersReturnsEmptyDictionaryOnNullRunSettings() { @@ -279,6 +285,10 @@ public void GetInProcDataCollectionRunSettingsThrowsExceptionWhenXmlNotValid() Assert.ThrowsException( () => XmlRunSettingsUtilities.GetInProcDataCollectionRunSettings(settingsXml)); } + #endregion + + #region CreateDefaultRunSettings tests + [TestMethod] public void CreateDefaultRunSettingsShouldReturnABasicRunSettings() { @@ -294,6 +304,10 @@ public void CreateDefaultRunSettingsShouldReturnABasicRunSettings() Assert.AreEqual(expectedRunSettings, defaultRunSettings); } + #endregion + + #region IsDataCollectionEnabled tests + [TestMethod] public void IsDataCollectionEnabledShouldReturnFalseIfRunSettingsIsNull() { @@ -319,6 +333,10 @@ public void IsDataCollectionEnabledShouldReturnTrueIfDataCollectionIsEnabled() Assert.IsTrue(XmlRunSettingsUtilities.IsDataCollectionEnabled(_runSettingsXmlWithDataCollectors)); } + #endregion + + #region IsInProcDataCollectionEnabled tests. + [TestMethod] public void IsInProcDataCollectionEnabledShouldReturnFalseIfRunSettingsIsNull() { @@ -343,6 +361,10 @@ public void IsInProcDataCollectionEnabledShouldReturnTrueIfDataCollectionIsEnabl Assert.IsTrue(XmlRunSettingsUtilities.IsInProcDataCollectionEnabled(ConvertOutOfProcDataCollectionSettingsToInProcDataCollectionSettings(_runSettingsXmlWithDataCollectors))); } + #endregion + + #region GetLoggerRunsettings tests + [TestMethod] public void GetLoggerRunSettingsShouldReturnNullWhenSettingsIsnull() { @@ -1117,6 +1139,10 @@ public void GetLoggerRunSettingsShouldReturnLastConfigurationElementIfMultiplePr loggerRunSettings.LoggerSettingsList.First().Configuration.InnerXml); } + #endregion + + #region GetDataCollectionRunSettings tests + [TestMethod] public void GetDataCollectionRunSettingsShouldReturnNullIfSettingsIsNull() { @@ -1147,6 +1173,8 @@ public void GetDataCollectionRunSettingsShouldThrowOnMalformedDataCollectorSetti Assert.ThrowsException(() => XmlRunSettingsUtilities.GetDataCollectionRunSettings(_runSettingsXmlWithIncorrectDataCollectorSettings)); } + #endregion + [TestMethod] public void GetDataCollectorsFriendlyNameShouldReturnListOfFriendlyName() { diff --git a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/Constants.cs b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/Constants.cs index 3db5129c1e..d35a18741b 100644 --- a/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/Constants.cs +++ b/test/Microsoft.TestPlatform.TestUtilities/PerfInstrumentation/Constants.cs @@ -55,6 +55,8 @@ public class Constants /// public const string AdapterDiscoveryTask = "AdapterDiscovery"; + #region PayLoad Property Names + /// /// The execution uri property. /// @@ -64,4 +66,6 @@ public class Constants /// The number of tests property. /// public const string NumberOfTestsProperty = "numberOfTests"; + #endregion + } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs index 9e802dc14e..4f15c659d2 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/CodeCoverageRunSettingsProcessorTests.cs @@ -18,14 +18,21 @@ namespace Microsoft.TestPlatform.Utilities.UnitTests; [TestClass] public class CodeCoverageRunSettingsProcessorTests { + #region Members private readonly XmlElement _defaultSettings; private readonly CodeCoverageRunSettingsProcessor _processor; + #endregion + + #region Constructors public CodeCoverageRunSettingsProcessorTests() { _defaultSettings = GetDefaultConfiguration(); _processor = new CodeCoverageRunSettingsProcessor(_defaultSettings); } + #endregion + + #region Test Methods [TestMethod] public void ProcessingShouldReturnNullForNullOrEmptySettings() { @@ -209,6 +216,9 @@ public void MixedTestShouldCorrectlyAddMissingTags() CompareResults(codeCoverageNodes.Item1, codeCoverageNodes.Item2, "./Attributes/Exclude"); CompareResults(codeCoverageNodes.Item1, codeCoverageNodes.Item2, "./Sources/Exclude"); } + #endregion + + #region Helpers private XmlNode ExtractNode(XmlNode node, string path) { try @@ -273,4 +283,5 @@ private void CompareResults(XmlNode currentSettingsRoot, XmlNode defaultSettings Assert.AreEqual(0, set.Count); } + #endregion } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs index 22b97e8d7c..ced891866b 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs @@ -392,6 +392,7 @@ public void UpdateTargetFrameworkShouldAddFrameworkXmlNodeIfNotPresent() [TestMethod] public void FilterCompatibleSourcesShouldIdentifyIncomaptiableSourcesAndConstructWarningMessage() { + #region Arrange _sourceArchitectures["AnyCPU1net46.dll"] = Architecture.AnyCPU; _sourceArchitectures["x64net47.exe"] = Architecture.X64; _sourceArchitectures["x86net45.dll"] = Architecture.X86; @@ -409,6 +410,7 @@ public void FilterCompatibleSourcesShouldIdentifyIncomaptiableSourcesAndConstruc var expected = string.Format(CultureInfo.CurrentCulture, OMResources.DisplayChosenSettings, _frameworkNet45, Constants.DefaultPlatform, sb.ToString(), MultiTargettingForwardLink); + #endregion var compatibleSources = InferRunSettingsHelper.FilterCompatibleSources(Constants.DefaultPlatform, Constants.DefaultPlatform, _frameworkNet45, _sourceArchitectures, _sourceFrameworks, out string warningMessage); // None of the DLLs passed are compatible to the chosen settings @@ -627,6 +629,8 @@ public void GetEnvironmentVariablesWithoutEnvVarNodeInRunSettingsShouldReturnNul Assert.IsNull(envVars); } + #region RunSettingsIncompatibeWithTestSettings Tests + [TestMethod] public void RunSettingsWithCodeCoverageAndInlineTestSettingsXml() { @@ -797,6 +801,10 @@ public void RunSettingsWithDisabledCollectionSettingsAndInlineTestSettingsXml() ConvertOutOfProcToInProcDataCollectionSettings(runSettingsWithDisabledCollectionSettingsAndInlineTestSettingsXml)), "Invalid response"); } + #endregion + + #region Private Methods + private string GetSourceIncompatibleMessage(string source) { return string.Format(CultureInfo.CurrentCulture, OMResources.SourceIncompatible, source, _sourceFrameworks[source].Name, _sourceArchitectures[source]); @@ -824,4 +832,5 @@ private string ConvertOutOfProcToInProcDataCollectionSettings(string settings) .Replace("", ""); } + #endregion } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs index 1e90879084..ea27d62e2b 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs @@ -15,6 +15,8 @@ namespace Microsoft.TestPlatform.Utilities.Tests; [TestClass] public class MsTestSettingsUtilitiesTests { + #region IsLegacyTestSettingsFile tests + [TestMethod] public void IsLegacyTestSettingsFileShouldReturnTrueIfTestSettingsExtension() { @@ -33,6 +35,10 @@ public void IsLegacyTestSettingsFileShouldReturnTrueIfVsmdiExtension() Assert.IsTrue(MSTestSettingsUtilities.IsLegacyTestSettingsFile("C:\\temp\\t.vsmdi")); } + #endregion + + #region Import tests + [TestMethod] public void ImportShouldThrowIfNotLegacySettingsFile() { @@ -113,4 +119,5 @@ public void ImportShouldEmbedTestSettingsAndDefaultRunConfigurationInformation() Assert.AreEqual(expectedSettingsXml, finalSettingsXml); } + #endregion } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs index 01af1d864c..59bc9ae7f3 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/XmlUtilitiesTests.cs @@ -17,6 +17,8 @@ namespace Microsoft.TestPlatform.Utilities.UnitTests; [TestClass] public class XmlUtilitiesTests { + #region GetNodeXml tests + [TestMethod] public void GetNodeXmlShouldThrowIfxmlDocumentIsNull() { @@ -59,6 +61,10 @@ public void GetNodeXmlShouldReturnNodeValue() Assert.AreEqual("abc", XmlUtilities.GetNodeXml(xmlDocument.CreateNavigator(), @"/RunSettings/RC")); } + #endregion + + #region IsValidNodeXmlValue tests + [TestMethod] public void IsValidNodeXmlValueShouldReturnFalseOnArgumentException() { @@ -87,6 +93,10 @@ public void IsValidNodeXmlValueShouldReturnTrueIfValidatorReturnsTrue() Assert.IsTrue(XmlUtilities.IsValidNodeXmlValue("foo", validator)); } + #endregion + + #region AppendOrModifyChild tests + [TestMethod] public void AppendOrModifyChildShouldModifyExistingNode() { @@ -164,6 +174,10 @@ public void AppendOrModifyChildShouldAppendANewNodeWithEscapingSpecialChars() Assert.AreEqual("a&bd\"e'f", rcxmlDocument.InnerText); } + #endregion + + #region RemoveChildNode tests + [TestMethod] public void RemoveChildNodeShouldNotModifyExistingXmlIfNodeDoesnotExist() { @@ -187,6 +201,10 @@ public void RemoveChildNodeShouldRemoveXmlIfExist() Assert.AreEqual(@"", xmlDocument.OuterXml); } + #endregion + + #region Private Methods + private XmlDocument GetXmlDocument(string settingsXml) { var doc = new XmlDocument(); @@ -195,4 +213,5 @@ private XmlDocument GetXmlDocument(string settingsXml) return doc; } + #endregion } diff --git a/test/TranslationLayer.UnitTests/TestSessionTests.cs b/test/TranslationLayer.UnitTests/TestSessionTests.cs index d62b0740f8..0ca9c20ac7 100644 --- a/test/TranslationLayer.UnitTests/TestSessionTests.cs +++ b/test/TranslationLayer.UnitTests/TestSessionTests.cs @@ -48,6 +48,7 @@ public void TestInitialize() _mockVsTestConsoleWrapper.Object); } + #region ITestSession [TestMethod] public void AbortTestRunShouldCallConsoleWrapperAbortTestRun() { @@ -341,6 +342,9 @@ public void StopTestSessionWithTwoArgsShouldCallConsoleWrapperStopTestSessionWit mockTestSessionEventsHandler2.Object), Times.Once); } + #endregion + + #region ITestSessionAsync [TestMethod] public async Task DiscoverTestsAsyncShouldCallConsoleWrapperDiscoverTestsWithCorrectArguments1() { @@ -619,4 +623,5 @@ await _testSession.StopTestSessionAsync( mockTestSessionEventsHandler2.Object), Times.Once); } + #endregion } diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs index b6e60a7494..f2a2badd2a 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleRequestSenderTests.cs @@ -53,6 +53,8 @@ public VsTestConsoleRequestSenderTests() new Mock().Object); } + #region Communication Tests + [TestMethod] public void InitializeCommunicationShouldSucceed() { @@ -316,6 +318,10 @@ public async Task InitializeCommunicationAsyncShouldFailConnectionIfProtocolIsNo _mockCommunicationManager.Verify(cm => cm.SendMessage(MessageType.VersionCheck, _protocolVersion), Times.Once); } + #endregion + + #region Discovery Tests + [TestMethod] public void DiscoverTestsShouldCompleteWithZeroTests() { @@ -710,6 +716,10 @@ public async Task DiscoverTestsAsyncShouldLogErrorWhenProcessExited() mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once); } + #endregion + + #region RunTests + [TestMethod] public void StartTestRunShouldCompleteWithZeroTests() { @@ -1849,6 +1859,10 @@ public async Task StartTestRunAsyncShouldLogErrorOnProcessExited() mockHandler.Verify(mh => mh.HandleLogMessage(TestMessageLevel.Error, It.IsAny()), Times.Once); } + #endregion + + #region Attachments Processing Tests + [TestMethod] public async Task ProcessTestRunAttachmentsAsyncShouldCompleteWithZeroAttachments() { @@ -2128,6 +2142,9 @@ public async Task ProcessTestRunAttachmentsAsyncShouldAbortOnExceptionInSendMess _mockCommunicationManager.Verify(cm => cm.StopServer(), Times.Never); } + #endregion + + #region Sessions API private const int MinimumProtocolVersionWithTestSessionSupport = 5; private const int TesthostPid = 5000; @@ -2590,6 +2607,10 @@ await _requestSender.StartTestSessionAsync( It.IsAny()), Times.Once); } + #endregion + + #region Private Methods + /// /// Serialize and Deserialize message as it would happen for real. /// @@ -2677,4 +2698,5 @@ private async Task InitializeCommunicationAsync(int protocolVersion) Assert.AreEqual(dummyPortInput, portOutput, "Connection must succeed."); } + #endregion } diff --git a/test/datacollector.UnitTests/DataCollectionManagerTests.cs b/test/datacollector.UnitTests/DataCollectionManagerTests.cs index 3698806084..614e281c7a 100644 --- a/test/datacollector.UnitTests/DataCollectionManagerTests.cs +++ b/test/datacollector.UnitTests/DataCollectionManagerTests.cs @@ -423,6 +423,8 @@ public void SessionEndedShouldCancelProcessingAttachmentRequestsIfSessionIsCance _mockDataCollectionAttachmentManager.Verify(x => x.Cancel(), Times.Once); } + #region TestCaseEventsTest + [TestMethod] public void TestCaseStartedShouldSendEventToDataCollector() { @@ -485,6 +487,7 @@ private void SetupMockDataCollector(Action())).Callback(callback.Invoke); } + #endregion } internal class TestableDataCollectionManager : DataCollectionManager diff --git a/test/vstest.console.UnitTests/CommandLine/TestRunResultAggregatorTests.cs b/test/vstest.console.UnitTests/CommandLine/TestRunResultAggregatorTests.cs index e344e25a27..63c93c86db 100644 --- a/test/vstest.console.UnitTests/CommandLine/TestRunResultAggregatorTests.cs +++ b/test/vstest.console.UnitTests/CommandLine/TestRunResultAggregatorTests.cs @@ -108,6 +108,8 @@ public void TestRunCompletionHandlerForAbortedRunShouldSetsOutcomeToFailed() Assert.AreEqual(TestOutcome.Failed, _resultAggregator.Outcome); } + #region Implementation + private class TestableTestRunStats : ITestRunStatistics { public TestableTestRunStats(Dictionary stats) @@ -137,4 +139,5 @@ public long this[TestOutcome testOutcome] } } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs index 1b385b9f5d..abfbac75e5 100644 --- a/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CLIRunSettingsArgumentProcessorTests.cs @@ -81,6 +81,8 @@ public void GetExecuterShouldReturnRunSettingsArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is CliRunSettingsArgumentExecutor); } + #region CLIRunSettingsArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -99,6 +101,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region CLIRunSettingsArgumentExecutor tests + [TestMethod] public void InitializeShouldNotThrowExceptionIfArgumentIsNull() { @@ -419,6 +425,8 @@ public static IEnumerable TestRunParameterArgValidTestCases() "") }, }; + #endregion + [TestMethod] public void InitializeShouldMergeTestRunParametersWithSpaces() { diff --git a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs index 133e04546e..fe9242251c 100644 --- a/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/CollectArgumentProcessorTests.cs @@ -58,6 +58,8 @@ public void GetExecuterShouldReturnCollectArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is CollectArgumentExecutor); } + #region CollectArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -78,6 +80,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region CollectArgumentExecutor tests + [TestMethod] public void InitializeShouldThrowIfArguemntIsNull() { @@ -702,4 +708,5 @@ public void InitializeShouldUpdateConfigurationsForExistingDataCollectorInRunSet " ", ""), _settingsProvider.ActiveRunSettings.SettingsXml); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs index 046e1ab8a4..8fbb8b845a 100644 --- a/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/EnableCodeCoverageArgumentProcessorTests.cs @@ -52,6 +52,8 @@ public void GetExecuterShouldReturnEnableCodeCoverageArgumentProcessorCapabiliti Assert.IsTrue(processor.Executor.Value is EnableCodeCoverageArgumentExecutor); } + #region EnableCodeCoverageArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -66,6 +68,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region EnableCodeCoverageArgumentExecutor tests + [TestMethod] public void InitializeShouldSetEnableCodeCoverageOfCommandLineOption() { @@ -169,4 +175,5 @@ public void InitializeShouldNotEnableOtherDataCollectors() ""), _settingsProvider.ActiveRunSettings.SettingsXml); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/FrameworkArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/FrameworkArgumentProcessorTests.cs index e1eff980f3..6aa6b2966e 100644 --- a/test/vstest.console.UnitTests/Processors/FrameworkArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/FrameworkArgumentProcessorTests.cs @@ -45,6 +45,8 @@ public void GetExecuterShouldReturnFrameworkArgumentExecutor() Assert.IsTrue(processor.Executor.Value is FrameworkArgumentExecutor); } + #region FrameworkArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -61,6 +63,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region FrameworkArgumentExecutor Initialize tests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNull() { @@ -121,10 +127,16 @@ public void InitializeShouldNotSetFrameworkIfSettingsFileIsLegacy() Assert.AreEqual(nameof(FrameworkVersion.Framework45), _runSettingsProvider.QueryRunSettingsNode(FrameworkArgumentExecutor.RunSettingsPath)); } + #endregion + + #region FrameworkArgumentExecutor Execute tests + [TestMethod] public void ExecuteShouldReturnSuccess() { Assert.AreEqual(ArgumentProcessorResult.Success, _executor.Execute()); } + #endregion + } diff --git a/test/vstest.console.UnitTests/Processors/HelpArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/HelpArgumentProcessorTests.cs index cf07c521ad..b0cff1ed6b 100644 --- a/test/vstest.console.UnitTests/Processors/HelpArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/HelpArgumentProcessorTests.cs @@ -36,6 +36,8 @@ public void GetExecuterShouldReturnHelpArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is HelpArgumentExecutor); } + #region HelpArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldAppropriateProperties() { @@ -52,6 +54,8 @@ public void CapabilitiesShouldAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + [TestMethod] public void ExecuterExecuteReturnArgumentProcessorResultAbort() { diff --git a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs index 542ccb498b..1cc20c918f 100644 --- a/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListFullyQualifiedTestsArgumentProcessorTests.cs @@ -111,6 +111,8 @@ public void GetExecuterShouldReturnListFullyQualifiedTestsArgumentProcessorCapab Assert.IsTrue(processor.Executor.Value is ListFullyQualifiedTestsArgumentExecutor); } + #region ListTestsArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -124,6 +126,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.AlwaysExecute); Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region ListTestsArgumentExecutorTests + [TestMethod] public void ExecutorInitializeWithValidSourceShouldAddItToTestSources() { @@ -282,6 +288,8 @@ public void ListFullyQualifiedTestsArgumentProcessorExecuteShouldInstrumentDisco _mockTestPlatformEventSource.Verify(x => x.DiscoveryRequestStop(), Times.Once); } + #endregion + private void RunListFullyQualifiedTestArgumentProcessorWithTraits(Mock mockDiscoveryRequest, Mock mockConsoleOutput, bool legitPath = true) { var mockTestPlatform = new Mock(); diff --git a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs index 3fe43c7cc0..bf0e0768ec 100644 --- a/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListTestsArgumentProcessorTests.cs @@ -109,6 +109,8 @@ public void GetExecuterShouldReturnListTestsArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is ListTestsArgumentExecutor); } + #region ListTestsArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -126,6 +128,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.AlwaysExecute); Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region ListTestsArgumentExecutorTests + [TestMethod] public void ExecutorInitializeWithValidSourceShouldAddItToTestSources() { @@ -254,6 +260,8 @@ public void ListTestArgumentProcessorExecuteShouldInstrumentDiscoveryRequestStop _mockTestPlatformEventSource.Verify(x => x.DiscoveryRequestStop(), Times.Once); } + #endregion + private void RunListTestArgumentProcessorExecuteWithMockSetup(Mock mockDiscoveryRequest, Mock mockConsoleOutput) { var mockTestPlatform = new Mock(); diff --git a/test/vstest.console.UnitTests/Processors/ListTestsTargetPathArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ListTestsTargetPathArgumentProcessorTests.cs index a67951c9e2..91b8a895e2 100644 --- a/test/vstest.console.UnitTests/Processors/ListTestsTargetPathArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ListTestsTargetPathArgumentProcessorTests.cs @@ -28,6 +28,8 @@ public void GetExecutorShouldReturnListTestsTargetPathArgumentProcessorCapabilit Assert.IsTrue(processor.Executor.Value is ListTestsTargetPathArgumentExecutor); } + #region TestCaseFilterArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldAppropriateProperties() { @@ -42,6 +44,8 @@ public void CapabilitiesShouldAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + [TestMethod] public void ExecutorInitializeWithNullOrEmptyListTestsTargetPathShouldThrowCommandLineException() { diff --git a/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs index 83171462af..e4595d0383 100644 --- a/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ParallelArgumentProcessorTests.cs @@ -44,6 +44,8 @@ public void GetExecuterShouldReturnParallelArgumentExecutor() Assert.IsTrue(processor.Executor.Value is ParallelArgumentExecutor); } + #region ParallelArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -61,6 +63,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region ParallelArgumentExecutor Initialize tests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNonNull() { @@ -79,10 +85,15 @@ public void InitializeShouldSetParallelValue() Assert.AreEqual("0", _runSettingsProvider.QueryRunSettingsNode(ParallelArgumentExecutor.RunSettingsPath)); } + #endregion + + #region ParallelArgumentExecutor Execute tests + [TestMethod] public void ExecuteShouldReturnSuccess() { Assert.AreEqual(ArgumentProcessorResult.Success, _executor.Execute()); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs index 899f29279e..6f83c1f424 100644 --- a/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/PlatformArgumentProcessorTests.cs @@ -44,6 +44,8 @@ public void GetExecuterShouldReturnPlatformArgumentExecutor() Assert.IsTrue(processor.Executor.Value is PlatformArgumentExecutor); } + #region PlatformArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -61,6 +63,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region PlatformArgumentExecutor Initialize tests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNull() { @@ -111,10 +117,15 @@ public void InitializeShouldNotConsiderCaseSensitivityOfTheArgumentPassed() Assert.AreEqual(nameof(ObjectModel.Architecture.ARM), _runSettingsProvider.QueryRunSettingsNode(PlatformArgumentExecutor.RunSettingsPath)); } + #endregion + + #region PlatformArgumentExecutor Execute tests + [TestMethod] public void ExecuteShouldReturnSuccess() { Assert.AreEqual(ArgumentProcessorResult.Success, _executor.Execute()); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs index 29c4c1c8e4..5e4c2ad6b9 100644 --- a/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/PortArgumentProcessorTests.cs @@ -44,6 +44,8 @@ public void GetExecutorShouldReturnPortArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is PortArgumentExecutor); } + #region PortArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldAppropriateProperties() { @@ -60,6 +62,8 @@ public void CapabilitiesShouldAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + [TestMethod] public void ExecutorInitializeWithNullOrEmptyPortShouldThrowCommandLineException() { diff --git a/test/vstest.console.UnitTests/Processors/ResponseFileArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ResponseFileArgumentProcessorTests.cs index 94a37d2280..226c4ec876 100644 --- a/test/vstest.console.UnitTests/Processors/ResponseFileArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ResponseFileArgumentProcessorTests.cs @@ -32,6 +32,8 @@ public void GetExecuterShouldReturnNull() Assert.IsNull(processor.Executor); } + #region ResponseFileArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -48,4 +50,5 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsTrue(capabilities.IsSpecialCommand); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs index a9297d914a..21105897ee 100644 --- a/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/ResultsDirectoryArgumentProcessorTests.cs @@ -50,6 +50,8 @@ public void GetExecuterShouldReturnResultsDirectoryArgumentExecutor() Assert.IsTrue(processor.Executor.Value is ResultsDirectoryArgumentExecutor); } + #region ResultsDirectoryArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -67,6 +69,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region ResultsDirectoryArgumentExecutor Initialize tests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNull() { @@ -142,12 +148,18 @@ public void InitializeShouldSetCommandLineOptionsAndRunSettingsForAbsolutePathVa Assert.AreEqual(absolutePath, _runSettingsProvider.QueryRunSettingsNode(ResultsDirectoryArgumentExecutor.RunSettingsPath)); } + #endregion + + #region ResultsDirectoryArgumentExecutor Execute tests + [TestMethod] public void ExecuteShouldReturnSuccess() { Assert.AreEqual(ArgumentProcessorResult.Success, _executor.Execute()); } + #endregion + private string TranslatePath(string path) { // RuntimeInformation has conflict when used diff --git a/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs index de93b4de24..acfe0af65d 100644 --- a/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSettingsArgumentProcessorTests.cs @@ -55,6 +55,8 @@ public void GetExecuterShouldReturnRunSettingsArgumentExecutor() Assert.IsTrue(processor.Executor.Value is RunSettingsArgumentExecutor); } + #region RunSettingsArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -72,6 +74,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region RunSettingsArgumentExecutor tests + [TestMethod] public void InitializeShouldThrowExceptionIfArgumentIsNull() { @@ -402,6 +408,10 @@ public void InitializeShouldUpdateTestCaseFilterIfProvided() // Assert. Assert.AreEqual(filter, CommandLineOptions.Instance.TestCaseFilterValue); } + #endregion + + #region Testable Implementations + private class TestableRunSettingsArgumentExecutor : RunSettingsArgumentExecutor { private readonly string _runSettingsString; @@ -430,4 +440,5 @@ protected override XmlReader GetReaderForFile(string runSettingsFile) } } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs index d8bb4d30ba..0bf445effc 100644 --- a/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunSpecificTestsArgumentProcessorTests.cs @@ -95,6 +95,8 @@ public void GetExecutorShouldReturnRunSpecificTestsArgumentExecutor() Assert.IsTrue(processor.Executor.Value is RunSpecificTestsArgumentExecutor); } + #region RunSpecificTestsArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -111,6 +113,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.AlwaysExecute); Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region RunSpecificTestsArgumentExecutorTests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNull() { @@ -594,6 +600,8 @@ public void ExecutorShouldNotDisplayWarningIfTestsAreExecuted() _mockOutput.Verify(op => op.WriteLine(It.Is(st => st.Contains("Additionally, path to test adapters can be specified using /TestAdapterPath command.")), OutputLevel.Warning), Times.Never); } + #endregion + private void ResetAndAddSourceToCommandLineOptions() { CommandLineOptions.Instance.Reset(); diff --git a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs index fb26f94a0f..fa1ae43a8d 100644 --- a/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/RunTestsArgumentProcessorTests.cs @@ -89,6 +89,8 @@ public void GetExecuterShouldReturnRunTestsArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is RunTestsArgumentExecutor); } + #region RunTestsArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -105,6 +107,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.AlwaysExecute); Assert.IsTrue(capabilities.IsSpecialCommand); } + #endregion + + #region RunTestsArgumentExecutorTests + [TestMethod] public void ExecutorExecuteShouldReturnSuccessWithoutExecutionInDesignMode() { @@ -238,6 +244,8 @@ public void TestRunRequestManagerShouldInstrumentExecutionRequestStop() _mockTestPlatformEventSource.Verify(x => x.ExecutionRequestStop(), Times.Once); } + #endregion + private ArgumentProcessorResult RunRunArgumentProcessorExecuteWithMockSetup(ITestRunRequest testRunRequest) { var mockTestPlatform = new Mock(); @@ -322,6 +330,10 @@ private void TestMessageHandler(object sender, TestRunMessageEventArgs e) } } +#region Testable implementation + public class TestableTestPluginCache : TestPluginCache { } + +#endregion diff --git a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs index a0b4b79493..0a43616288 100644 --- a/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestAdapterPathArgumentProcessorTests.cs @@ -54,6 +54,8 @@ public void GetExecuterShouldReturnTestAdapterPathArgumentProcessorCapabilities( Assert.IsTrue(processor.Executor.Value is TestAdapterPathArgumentExecutor); } + #region TestAdapterPathArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -71,6 +73,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region TestAdapterPathArgumentExecutor tests + [TestMethod] public void InitializeShouldThrowIfArgumentIsNull() { @@ -302,6 +308,10 @@ public void InitializeShouldTrimTrailingAndLeadingDoubleQuotes() } + #endregion + + #region Testable implementations + private class TestableTestAdapterPathArgumentExecutor : TestAdapterPathArgumentExecutor { internal TestableTestAdapterPathArgumentExecutor(CommandLineOptions options, IRunSettingsProvider runSettingsProvider, IOutput output, IFileHelper fileHelper) @@ -312,4 +322,5 @@ internal TestableTestAdapterPathArgumentExecutor(CommandLineOptions options, IRu internal Func> TestAdapters { get; set; } } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/TestCaseFilterArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestCaseFilterArgumentProcessorTests.cs index ab68208d17..9b49ad62ad 100644 --- a/test/vstest.console.UnitTests/Processors/TestCaseFilterArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestCaseFilterArgumentProcessorTests.cs @@ -28,6 +28,8 @@ public void GetExecutorShouldReturnTestCaseFilterArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is TestCaseFilterArgumentExecutor); } + #region TestCaseFilterArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldAppropriateProperties() { @@ -44,6 +46,8 @@ public void CapabilitiesShouldAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + [TestMethod] public void ExecutorInitializeWithNullOrEmptyTestCaseFilterShouldThrowCommandLineException() { diff --git a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs index d0fdcc74fc..685c6f6d5e 100644 --- a/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/TestSourceArgumentProcessorTests.cs @@ -43,6 +43,8 @@ public void GetExecuterShouldReturnTestSourceArgumentProcessorCapabilities() Assert.IsTrue(processor.Executor.Value is TestSourceArgumentExecutor); } + #region TestSourceArgumentProcessorCapabilitiesTests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -59,6 +61,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsTrue(capabilities.IsSpecialCommand); } + #endregion + + #region TestSourceArgumentExecutorTests + [TestMethod] public void ExecuterInitializeWithInvalidSourceShouldThrowCommandLineException() { @@ -111,4 +117,5 @@ public void ExecutorExecuteReturnArgumentProcessorResultSuccess() Assert.AreEqual(ArgumentProcessorResult.Success, result); } + #endregion } diff --git a/test/vstest.console.UnitTests/Processors/UseVsixExtensionsArgumentProcessorTests.cs b/test/vstest.console.UnitTests/Processors/UseVsixExtensionsArgumentProcessorTests.cs index 158d2c88bf..61171a37a8 100644 --- a/test/vstest.console.UnitTests/Processors/UseVsixExtensionsArgumentProcessorTests.cs +++ b/test/vstest.console.UnitTests/Processors/UseVsixExtensionsArgumentProcessorTests.cs @@ -47,6 +47,8 @@ public void GetExecuterShouldReturnUseVsixExtensionsArgumentProcessorCapabilitie Assert.IsTrue(processor.Executor.Value is UseVsixExtensionsArgumentExecutor); } + #region UseVsixExtensionsArgumentProcessorCapabilities tests + [TestMethod] public void CapabilitiesShouldReturnAppropriateProperties() { @@ -63,6 +65,10 @@ public void CapabilitiesShouldReturnAppropriateProperties() Assert.IsFalse(capabilities.IsSpecialCommand); } + #endregion + + #region UseVsixExtensionsArgumentExecutor tests + [TestMethod] public void InitializeShouldThrowExceptionIfArgumentIsNull() { @@ -102,4 +108,5 @@ public void InitializeForArgumentEqualfalseShouldNotCallTestRequestManagerInitia _testRequestManager.Verify(trm => trm.InitializeExtensions(It.IsAny>(), true), Times.Never); } + #endregion }