-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save work (started ArtifactProcessingTests)
- Loading branch information
1 parent
75e71d0
commit f5188bd
Showing
9 changed files
with
124 additions
and
66 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
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
69 changes: 69 additions & 0 deletions
69
...icrosoft.TestPlatform.CrossPlatEngine.UnitTests/PostProcessing/ArtifactProcessingTests.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,69 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.ObjectModel; | ||
|
||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; | ||
using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.ArtifactProcessing; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; | ||
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities; | ||
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
using Moq; | ||
|
||
namespace TestPlatform.CrossPlatEngine.UnitTests; | ||
|
||
[TestClass] | ||
public class ArtifactProcessingTests | ||
{ | ||
private readonly Mock<IFileHelper> _fileHelperMock = new(); | ||
private readonly Mock<ITestRunAttachmentsProcessingManager> _testRunAttachmentsProcessingManagerMock = new(); | ||
private readonly Mock<ITestRunAttachmentsProcessingEventsHandler> _testRunAttachmentsProcessingEventsHandlerMock = new(); | ||
private readonly Mock<IFeatureFlag> _featureFlagMock = new(); | ||
private readonly Mock<IDataSerializer> _dataSerializer = new(); | ||
private readonly Mock<ITestRunStatistics> _testRunStatistics = new(); | ||
private ArtifactProcessingManager _artifactProcessingManager; | ||
|
||
public ArtifactProcessingTests() | ||
{ | ||
_featureFlagMock.Setup(x => x.IsEnabled(It.IsAny<string>())).Returns(true); | ||
_fileHelperMock.Setup(x => x.GetTempPath()).Returns("/tmp"); | ||
|
||
_artifactProcessingManager = | ||
new ArtifactProcessingManager(Guid.NewGuid().ToString(), | ||
_fileHelperMock.Object, | ||
_testRunAttachmentsProcessingManagerMock.Object, | ||
_dataSerializer.Object, | ||
_testRunAttachmentsProcessingEventsHandlerMock.Object, | ||
_featureFlagMock.Object); | ||
} | ||
|
||
[TestMethod] | ||
public void CollectArtifacts_NullSessionIdShouldReturn() | ||
{ | ||
_artifactProcessingManager = | ||
new ArtifactProcessingManager(null, | ||
_fileHelperMock.Object, | ||
_testRunAttachmentsProcessingManagerMock.Object, | ||
_dataSerializer.Object, | ||
_testRunAttachmentsProcessingEventsHandlerMock.Object, | ||
_featureFlagMock.Object); | ||
|
||
var testRunCompleteEventArgs = new TestRunCompleteEventArgs(_testRunStatistics.Object, | ||
false, | ||
false, | ||
null, | ||
new Collection<AttachmentSet>() | ||
{ | ||
new AttachmentSet(new Uri("//sample"),"") | ||
}, | ||
TimeSpan.Zero); | ||
|
||
_artifactProcessingManager.CollectArtifacts(testRunCompleteEventArgs, string.Empty); | ||
_fileHelperMock.Verify(x => x.WriteAllTextToFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never); | ||
} | ||
} |
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