|
1 | 1 | using System; |
| 2 | +using System.Globalization; |
2 | 3 | using System.Xml; |
3 | 4 | using JetBrains.ReSharper.TaskRunnerFramework; |
4 | 5 |
|
5 | 6 | namespace XunitContrib.Runner.ReSharper.RemoteRunner.Tasks |
6 | 7 | { |
7 | | - // This class's only purpose is to be the first class in a task sequence. |
8 | | - // The first task is always serialised and sent from the external process |
9 | | - // to the main ReSharper process. If we use XunitTestAssemblyTask as the |
10 | | - // first class, it includes the path to the assembly under test, which |
11 | | - // means failing tests if the assembly is in a different location to what's |
12 | | - // in the gold files. So, this class is used first, and when it gets |
13 | | - // serialised, there is nothing changeable in it (the project id is constant |
14 | | - // for tests) and as long as we never report the assembly task (there's no |
15 | | - // need, it's not a meaningful task - not associated with an element), then |
16 | | - // our tests will pass |
| 8 | + // This class serves two purposes. Firstly, it notifies the runner of some |
| 9 | + // config that's only available from the provider (i.e. if the host is running, |
| 10 | + // debugging, covering or continuous testing). Secondly, it means that the |
| 11 | + // first task in the sequence isn't XunitTestAssemblyTask, which contains |
| 12 | + // the path of the assembly under test. This greatly helps the tests for |
| 13 | + // the runner itself, as the first task is output to the gold file, and |
| 14 | + // showing the path to the assembly under test will break things if we |
| 15 | + // run the tests in a different location. We can serialise this task, |
| 16 | + // as the project ID is constant in test runs, and there is nothing |
| 17 | + // else changeable in it. As long as we never report the assembly |
| 18 | + // task (there's no need, it's not a meaningful task - not associated |
| 19 | + // with an element), then our tests will pass. |
17 | 20 | [Serializable] |
18 | 21 | public class XunitBootstrapTask : RemoteTask, IEquatable<XunitBootstrapTask> |
19 | 22 | { |
20 | | - public XunitBootstrapTask(string projectId) |
| 23 | + |
| 24 | + public XunitBootstrapTask(string projectId, bool disableAllConcurrency) |
21 | 25 | : base(XunitTaskRunner.RunnerId) |
22 | 26 | { |
| 27 | + DisableAllConcurrency = disableAllConcurrency; |
23 | 28 | ProjectId = projectId; |
24 | 29 | } |
25 | 30 |
|
26 | 31 | public XunitBootstrapTask(XmlElement element) |
27 | 32 | : base(element) |
28 | 33 | { |
29 | 34 | ProjectId = GetXmlAttribute(element, AttributeNames.ProjectId); |
| 35 | + |
| 36 | + bool disableAllConcurrency; |
| 37 | + if (!bool.TryParse(GetXmlAttribute(element, AttributeNames.DisableAllConcurrency), out disableAllConcurrency)) |
| 38 | + disableAllConcurrency = false; |
| 39 | + DisableAllConcurrency = disableAllConcurrency; |
30 | 40 | } |
31 | 41 |
|
32 | 42 | public string ProjectId { get; set; } |
| 43 | + public bool DisableAllConcurrency { get; set; } |
| 44 | + |
33 | 45 | public override bool IsMeaningfulTask { get { return false; }} |
34 | 46 |
|
35 | 47 | public override void SaveXml(XmlElement element) |
36 | 48 | { |
37 | 49 | base.SaveXml(element); |
38 | 50 | SetXmlAttribute(element, AttributeNames.ProjectId, ProjectId); |
| 51 | + SetXmlAttribute(element, AttributeNames.DisableAllConcurrency, DisableAllConcurrency.ToString(CultureInfo.InvariantCulture)); |
39 | 52 | } |
40 | 53 |
|
41 | 54 | public override bool Equals(object obj) |
|
0 commit comments