Skip to content

Commit c4b236b

Browse files
author
Max Young
committed
Change AutomationElementXTest.cs to nunit
Updated automation element x test to nunit and added frameworkid as a property of the WhiteUITestBase.
1 parent d50e5a5 commit c4b236b

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
using System.Collections.Generic;
1+
using NUnit.Framework;
22
using TestStack.White.UIA;
33
using TestStack.White.UIItems;
4-
using Xunit;
54

65
namespace TestStack.White.UITests.UIA
76
{
8-
public class AutomationElementXTest : WhiteTestBase
7+
[TestFixture(WindowsFramework.WinForms)]
8+
[TestFixture(WindowsFramework.Wpf)]
9+
public class AutomationElementXTest : WhiteUITestBase
910
{
10-
public void TestToString(string frameworkid)
11-
{
12-
var button = MainWindow.Get<Button>("ButtonWithTooltip");
13-
string s = button.AutomationElement.Display();
14-
Assert.Equal(string.Format("AutomationId:ButtonWithTooltip, Name:Button with Tooltip, ControlType:button, FrameworkId:{0}", frameworkid), s);
15-
}
11+
public AutomationElementXTest(WindowsFramework framework)
12+
: base(framework) { }
1613

17-
protected override void ExecuteTestRun(WindowsFramework framework)
14+
[Test]
15+
public void TestToString()
1816
{
19-
RunTest(()=>TestToString(framework.FrameworkId()));
20-
}
21-
22-
protected override IEnumerable<WindowsFramework> SupportedFrameworks()
23-
{
24-
yield return WindowsFramework.WinForms;
25-
yield return WindowsFramework.Wpf;
17+
var button = MainWindow.Get<Button>("ButtonWithTooltip");
18+
var display = button.AutomationElement.Display();
19+
Assert.That(display, Is.EqualTo(string.Format( "AutomationId:ButtonWithTooltip, Name:Button with Tooltip, ControlType:button, FrameworkId:{0}", FrameworkId)));
2620
}
2721
}
2822
}

src/TestStack.White.UITests/WhiteUITestBase.cs

+12
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,17 @@ protected void SelectPropertyGridTab()
155155
{
156156
MainWindow.Tabs[0].SelectTabPage(4);
157157
}
158+
159+
protected string FrameworkId
160+
{
161+
get
162+
{
163+
var type = Framework.GetType();
164+
var memInfo = type.GetMember(Framework.ToString());
165+
var attributes = memInfo[0].GetCustomAttributes(typeof(FrameworkIdAttribute), false);
166+
return ((FrameworkIdAttribute)attributes[0]).FrameworkId;
167+
}
168+
private set { }
169+
}
158170
}
159171
}

src/TestStack.White.sln.DotSettings

+2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
1616
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
1717
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean>
18+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
1819
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
20+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
1921
<s:Boolean x:Key="/Default/Environment/UnitTesting/ShadowCopy/@EntryValue">False</s:Boolean>
2022
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String>
2123
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String></wpf:ResourceDictionary>

0 commit comments

Comments
 (0)