This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'crwilcox-feature/UITests'
- Loading branch information
Showing
580 changed files
with
21,451 additions
and
10,031 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,4 @@ src/R.sdf | |
# R files | ||
.Rproj.user | ||
src/R.VC.opendb | ||
TestFiles/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RunSettings> | ||
<DataCollectionRunSettings> | ||
<DataCollectors> | ||
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" | ||
assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | ||
<Configuration> | ||
<CodeCoverage> | ||
<ModulePaths> | ||
<Include> | ||
<ModulePath>.*\.dll$</ModulePath> | ||
<ModulePath>.*\.exe</ModulePath> | ||
</Include> | ||
<Exclude> | ||
<ModulePath>.*test.*</ModulePath> | ||
<ModulePath>.*xunit.*</ModulePath> | ||
<ModulePath>.*fluent.*</ModulePath> | ||
<ModulePath>.*mocks.*</ModulePath> | ||
<ModulePath>.*editor.application.*</ModulePath> | ||
</Exclude> | ||
</ModulePaths> | ||
<Functions> | ||
<Exclude> | ||
<Function>^std::.*</Function> | ||
<Function>^boost::.*</Function> | ||
<Function>^websocketpp::.*</Function> | ||
<Function>^__sc.*</Function> | ||
</Exclude> | ||
</Functions> | ||
</CodeCoverage> | ||
</Configuration> | ||
</DataCollector> | ||
</DataCollectors> | ||
</DataCollectionRunSettings> | ||
</RunSettings> |
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,11 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
namespace Microsoft.Common.Core { | ||
public static class AssemblyExtensions { | ||
public static string GetAssemblyPath(this Assembly assembly) { | ||
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | ||
return new Uri(codeBase).LocalPath; | ||
} | ||
} | ||
} |
File renamed without changes.
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,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Common.Core { | ||
public static class StackExtensions { | ||
public static IEnumerable<T> PopWhile<T>(this Stack<T> stack, Func<T, bool> predicate) { | ||
while (stack.Count > 0) { | ||
var item = stack.Peek(); | ||
if (!predicate(item)) { | ||
break; | ||
} | ||
|
||
yield return stack.Pop(); | ||
} | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,33 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Common.Core.Test.Script; | ||
using Microsoft.Common.Core.Test.Utility; | ||
using Microsoft.UnitTests.Core.Threading; | ||
|
||
namespace Microsoft.Common.Core.Test.Controls { | ||
[ExcludeFromCodeCoverage] | ||
public sealed class ControlTestScript : TestScript, IDisposable { | ||
public ControlTestScript(Type type) { | ||
ControlWindow.Create(type); | ||
} | ||
/// <summary> | ||
/// Invokes a particular action in the control window thread | ||
/// </summary> | ||
public void Invoke(Action action) { | ||
UIThreadHelper.Instance.Invoke(action); | ||
} | ||
|
||
public void Dispose() { | ||
ControlWindow.Close(); | ||
} | ||
|
||
public string WriteVisualTree(bool writeProperties = true) { | ||
VisualTreeWriter w = new VisualTreeWriter(); | ||
string tree = null; | ||
Invoke(() => { | ||
tree = w.WriteTree(ControlWindow.Control, writeProperties); | ||
}); | ||
return tree; | ||
} | ||
} | ||
} |
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,85 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using Microsoft.UnitTests.Core.Threading; | ||
using Screen = System.Windows.Forms.Screen; | ||
|
||
namespace Microsoft.Common.Core.Test.Controls { | ||
/// <summary> | ||
/// Control window | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
internal static class ControlWindow { | ||
[ExcludeFromCodeCoverage] | ||
class ControlTestRequest { | ||
public Type ControlType { get; } | ||
|
||
public ControlTestRequest(Type controlType) { | ||
ControlType = controlType; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Control that is being tested | ||
/// </summary> | ||
public static Control Control { get; private set; } | ||
/// <summary> | ||
/// WPF window that contains the control | ||
/// </summary> | ||
public static Window Window { get; private set; } | ||
|
||
/// <summary> | ||
/// <summary> | ||
/// Creates WPF window and control instance then hosts control in the window. | ||
/// </summary> | ||
public static void Create(Type controlType) { | ||
var evt = new ManualResetEventSlim(false); | ||
Task.Run(() => UIThreadHelper.Instance.Invoke(() => CreateWindowInstance(new ControlTestRequest(controlType), evt))); | ||
evt.Wait(); | ||
} | ||
|
||
private static void CreateWindowInstance(ControlTestRequest request, ManualResetEventSlim evt) { | ||
|
||
Window = new Window(); | ||
|
||
if (Screen.AllScreens.Length == 1) { | ||
Window.Left = 0; | ||
Window.Top = 50; | ||
} | ||
else { | ||
Screen secondary = Screen.AllScreens.FirstOrDefault(x => !x.Primary); | ||
Window.Left = secondary.WorkingArea.Left; | ||
Window.Top = secondary.WorkingArea.Top + 50; | ||
} | ||
|
||
Window.Width = 800; | ||
Window.Height = 600; | ||
|
||
Control = Activator.CreateInstance(request.ControlType) as Control; | ||
Window.Title = "Control - " + request.ControlType.ToString(); | ||
Window.Content = Control; | ||
|
||
evt.Set(); | ||
|
||
Window.Topmost = true; | ||
Window.ShowDialog(); | ||
} | ||
|
||
/// <summary> | ||
/// Closes editor window | ||
/// </summary> | ||
public static void Close() { | ||
var action = new Action(() => { | ||
IDisposable disp = Window.Content as IDisposable; | ||
disp?.Dispose(); | ||
Window.Close(); | ||
}); | ||
|
||
UIThreadHelper.Instance.Invoke(action); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.