forked from killswitch1111/powerguivsx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerShellTestContainer.cs
More file actions
98 lines (84 loc) · 3 KB
/
Copy pathPowerShellTestContainer.cs
File metadata and controls
98 lines (84 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestWindow.Extensibility;
using Microsoft.VisualStudio.TestWindow.Extensibility.Model;
namespace PowerShellTools.TestAdapter
{
public class PowerShellTestContainer : ITestContainer
{
private readonly ITestContainerDiscoverer _discoverer;
private readonly DateTime _timeStamp;
public PowerShellTestContainer(ITestContainerDiscoverer discoverer, string source, Uri executorUri)
: this(discoverer, source, executorUri, Enumerable.Empty<Guid>())
{
}
public PowerShellTestContainer(ITestContainerDiscoverer discoverer, string source, Uri executorUri,
IEnumerable<Guid> debugEngines)
{
Source = source;
ExecutorUri = executorUri;
DebugEngines = debugEngines;
_discoverer = discoverer;
TargetFramework = FrameworkVersion.None;
TargetPlatform = Architecture.AnyCPU;
_timeStamp = GetTimeStamp();
}
private PowerShellTestContainer(PowerShellTestContainer copy)
: this(copy._discoverer, copy.Source, copy.ExecutorUri)
{
_timeStamp = copy._timeStamp;
}
public Uri ExecutorUri { get; set; }
public string Source { get; set; }
public IEnumerable<Guid> DebugEngines { get; set; }
public FrameworkVersion TargetFramework { get; set; }
public Architecture TargetPlatform { get; set; }
public IDeploymentData DeployAppContainer()
{
return null;
}
public bool IsAppContainerTestContainer
{
get { return false; }
}
public ITestContainerDiscoverer Discoverer
{
get { return _discoverer; }
}
public int CompareTo(ITestContainer other)
{
var testContainer = other as PowerShellTestContainer;
if (testContainer == null)
{
return -1;
}
int result = String.Compare(Source, testContainer.Source, StringComparison.OrdinalIgnoreCase);
if (result != 0)
{
return result;
}
int ts = _timeStamp.CompareTo(testContainer._timeStamp);
return ts;
}
public ITestContainer Snapshot()
{
return new PowerShellTestContainer(this);
}
private DateTime GetTimeStamp()
{
if (!String.IsNullOrEmpty(Source) && File.Exists(Source))
{
return File.GetLastWriteTime(Source);
}
return DateTime.MinValue;
}
public override string ToString()
{
return ExecutorUri + "/" + Source;
//return this.ExecutorUri.ToString();
}
}
}