-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from AbhitejJohn/portlatest
Porting latest changes.
- Loading branch information
Showing
77 changed files
with
1,991 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/Adapter/MSTestAdapter.PlatformServices.CoreSystem/Services/CoreTraceListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
using System.IO; | ||
using System; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
{ | ||
/// <summary> | ||
/// Internal implementation of TraceListener exposed to the user. | ||
/// </summary> | ||
/// <remarks> | ||
/// The virtual operations of the TraceListener are implemented here | ||
/// like Close(), Dispose() etc. | ||
/// </remarks> | ||
public class TraceListenerWrapper : ITraceListener | ||
{ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of an object using the specified writer as recipient of the | ||
/// tracing or debugging output. | ||
/// </summary> | ||
public TraceListenerWrapper(TextWriter textWriter) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Close() | ||
{ | ||
return; | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
return; | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public TextWriter GetWriter() | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/Adapter/MSTestAdapter.PlatformServices.CoreSystem/Services/CoreTraceListenerManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
using System.IO; | ||
|
||
/// <summary> | ||
/// Internal implementation of TraceListenerManager exposed to the user. | ||
/// Responsible for performing Add(), Remove(), Close(), Dispose() operations on traceListener object. | ||
/// </summary> | ||
public class TraceListenerManager : ITraceListenerManager | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of a TraceListenerManager object. | ||
/// </summary> | ||
public TraceListenerManager(TextWriter outputWriter, TextWriter errorWriter) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Add(ITraceListener traceListener) | ||
{ | ||
return; | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Close(ITraceListener traceListener) | ||
{ | ||
return; | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Dispose(ITraceListener traceListener) | ||
{ | ||
return; | ||
} | ||
|
||
/// <summary> | ||
/// Returning as this feature is not supported in ASP .net and UWP | ||
/// </summary> | ||
public void Remove(ITraceListener traceListner) | ||
{ | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/Adapter/MSTestAdapter.PlatformServices.Desktop/Services/DesktopTraceListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
using System.Diagnostics; | ||
using System; | ||
using System.IO; | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
{ | ||
/// <summary> | ||
/// Internal implementation of TraceListener exposed to the user. | ||
/// The virtual operations of the TraceListener are implemented here | ||
/// like Close(), Dispose() etc. | ||
/// </summary> | ||
public class TraceListenerWrapper : TextWriterTraceListener, ITraceListener | ||
{ | ||
// Summary: | ||
// Initializes a new instance of an object that derives from System.Diagnostics.TextWriterTraceListener | ||
// Class and initializes TextWriterTraceListener object using the specified writer as recipient of the | ||
// tracing or debugging output. | ||
public TraceListenerWrapper(TextWriter textWriter):base(textWriter) | ||
{ | ||
} | ||
|
||
// Summary: | ||
// Wrapper over Close() of System.Diagnostics.TextWriterTraceListener.Writer | ||
public override void Close() | ||
{ | ||
base.Close(); | ||
} | ||
|
||
// Summary: | ||
// Wrapper over Dispose() of System.Diagnostics.TextWriterTraceListener object | ||
public new void Dispose() | ||
{ | ||
base.Dispose(); | ||
} | ||
|
||
// Summary: | ||
// Gets the text writer of System.Diagnostics.TextWriterTraceListener.Writer | ||
// that receives the tracing or debugging output. | ||
public TextWriter GetWriter() | ||
{ | ||
return base.Writer; | ||
} | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/Adapter/MSTestAdapter.PlatformServices.Desktop/Services/DesktopTraceListenerManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | ||
{ | ||
using System; | ||
using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Globalization; | ||
|
||
/// <summary> | ||
/// Internal implementation of TraceListenerManager exposed to the user. | ||
/// Responsible for performing Add(), Remove(), Close(), Dispose() operations on traceListener object. | ||
/// </summary> | ||
public class TraceListenerManager : ITraceListenerManager | ||
{ | ||
/// <summary> | ||
/// Original output stream | ||
/// </summary> | ||
private TextWriter origStdOut; | ||
|
||
/// <summary> | ||
/// Original error stream | ||
/// </summary> | ||
private TextWriter origStdErr; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of a TraceListenerManager object. | ||
/// Also, updates the output/error streams with redirected outputWriter and errorWriter | ||
/// </summary> | ||
public TraceListenerManager(TextWriter outputWriter, TextWriter errorWriter) | ||
{ | ||
origStdOut = Console.Out; | ||
origStdErr = Console.Error; | ||
|
||
// Update the output/error streams with redirected streams | ||
Console.SetOut(outputWriter); | ||
Console.SetError(errorWriter); | ||
} | ||
|
||
/// <summary> | ||
/// Adds the arguement traceListener object to System.Diagnostics.TraceListenerCollection. | ||
/// </summary> | ||
public void Add(ITraceListener traceListener) | ||
{ | ||
try | ||
{ | ||
Trace.Listeners.Add(traceListener as TextWriterTraceListener); | ||
} | ||
catch (Exception ex) | ||
{ | ||
// Catch exceptions if the configuration file is invalid and allow a stack | ||
// trace to show the error on the test method instead of here. | ||
if (!(ex.InnerException is System.Configuration.ConfigurationErrorsException)) | ||
{ | ||
throw; | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Removes the arguement traceListener object from System.Diagnostics.TraceListenerCollection. | ||
/// </summary> | ||
public void Remove(ITraceListener traceListner) | ||
{ | ||
Trace.Listeners.Remove(traceListner as TextWriterTraceListener); | ||
} | ||
|
||
/// <summary> | ||
/// Wrapper over Close() of ITraceListener. | ||
/// </summary> | ||
public void Close(ITraceListener traceListener) | ||
{ | ||
traceListener.Close(); | ||
} | ||
|
||
/// <summary> | ||
/// Wrapper over Dispose() of ITraceListener. | ||
/// Also resets the standard output/error streams. | ||
/// </summary> | ||
public void Dispose(ITraceListener traceListener) | ||
{ | ||
traceListener.Dispose(); | ||
Console.SetOut(origStdOut); | ||
Console.SetError(origStdErr); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.