- 
                Notifications
    
You must be signed in to change notification settings  - Fork 288
 
Implementing 'AddResultFile' for NetCore TestContext #609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
cdc3755
              7ead94c
              f4b81d5
              77b7a7f
              764e141
              32505c9
              65d99ca
              5cd99f8
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -9,6 +9,7 @@ namespace Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices | |
| using System.Diagnostics; | ||
| using System.Globalization; | ||
| using System.IO; | ||
| using System.Linq; | ||
| using System.Threading; | ||
| using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface; | ||
| using Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.ObjectModel; | ||
| 
        
          
        
         | 
    @@ -29,6 +30,11 @@ public class TestContextImplementation : UTF.TestContext, ITestContext | |
| private static readonly string FullyQualifiedTestClassNameLabel = "FullyQualifiedTestClassName"; | ||
| private static readonly string TestNameLabel = "TestName"; | ||
| 
     | 
||
| /// <summary> | ||
| /// List of result files associated with the test | ||
| /// </summary> | ||
| private readonly IList<string> testResultFiles; | ||
                
      
                  parrainc marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| 
     | 
||
| /// <summary> | ||
| /// Properties | ||
| /// </summary> | ||
| 
          
            
          
           | 
    @@ -61,6 +67,7 @@ public TestContextImplementation(ITestMethod testMethod, StringWriter writer, ID | |
| this.testMethod = testMethod; | ||
| this.properties = new Dictionary<string, object>(properties); | ||
| this.stringWriter = writer; | ||
| this.testResultFiles = new List<string>(); | ||
| this.CancellationTokenSource = new CancellationTokenSource(); | ||
| this.InitializeProperties(); | ||
| } | ||
| 
          
            
          
           | 
    @@ -133,6 +140,16 @@ public UTF.TestContext Context | |
| } | ||
| } | ||
| 
     | 
||
| public override void AddResultFile(string fileName) | ||
| { | ||
| if (string.IsNullOrEmpty(fileName)) | ||
                
       | 
||
| { | ||
| throw new ArgumentException("The parameter should not be null or empty.", "fileName"); | ||
| } | ||
| 
     | 
||
| this.testResultFiles.Add(Path.GetFullPath(fileName)); | ||
| } | ||
| 
     | 
||
| /// <summary> | ||
| /// Set the unit-test outcome | ||
| /// </summary> | ||
| 
          
            
          
           | 
    @@ -174,15 +191,6 @@ public void AddProperty(string propertyName, string propertyValue) | |
| this.properties.Add(propertyName, propertyValue); | ||
| } | ||
| 
     | 
||
| /// <summary> | ||
| /// Returning null as this feature is not supported in ASP .net and UWP | ||
| /// </summary> | ||
| /// <returns>List of result files. Null presently.</returns> | ||
| public IList<string> GetResultFiles() | ||
| { | ||
| return null; | ||
| } | ||
| 
     | 
||
| /// <summary> | ||
| /// When overridden in a derived class, used to write trace messages while the | ||
| /// test is running. | ||
| 
          
            
          
           | 
    @@ -230,6 +238,15 @@ public override void WriteLine(string format, params object[] args) | |
| } | ||
| } | ||
| 
     | 
||
| /// <summary> | ||
| /// Returns null as this feature is not supported in ASP .net and UWP | ||
| /// </summary> | ||
| /// <returns>List of result files. Null presently.</returns> | ||
| public IList<string> GetResultFiles() | ||
| { | ||
| return null; | ||
| } | ||
| 
     | 
||
| /// <summary> | ||
| /// Gets messages from the testContext writeLines | ||
| /// </summary> | ||
| 
          
            
          
           | 
    ||
Uh oh!
There was an error while loading. Please reload this page.