Skip to content

Commit 885a996

Browse files
author
Jake Ginnivan
committed
Some cleanup of this PR
1 parent a3d225a commit 885a996

File tree

7 files changed

+35
-52
lines changed

7 files changed

+35
-52
lines changed

src/TestStack.White.UnitTests/UIItems/DateFormatTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public class DateFormatTest
88
[Fact]
99
public void DifferentDateFormats()
1010
{
11-
Assert.Equal(DateFormat.dayMonthYear, DateFormat.Create("-", "dd-MM-yyyy"));
12-
Assert.Equal(DateFormat.dayMonthYear, DateFormat.Create("-", "d-M-yyyy"));
11+
Assert.Equal(DateFormat.DayMonthYear, DateFormat.Create("-", "dd-MM-yyyy"));
12+
Assert.Equal(DateFormat.DayMonthYear, DateFormat.Create("-", "d-M-yyyy"));
1313
}
1414
}
1515
}

src/TestStack.White/Application.cs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ private Application(Process process)
3838
/// <summary>
3939
/// Runs the process identified by the executable and creates Application object for this executable
4040
/// </summary>
41-
/// <param name="executable">location of the executable</param>
42-
/// <returns></returns>
43-
/// <exception cref="ArgumentNullException"></exception>
44-
/// <exception cref="WhiteException">when some error occured</exception>
41+
/// <param name="executable">Path to the executable</param>
42+
/// <exception cref="ArgumentNullException">No process info passed</exception>
43+
/// <exception cref="WhiteException">White Failed to Launch or Attached to process</exception>
4544
public static Application Launch(string executable)
4645
{
4746
var processStartInfo = new ProcessStartInfo(executable);
@@ -51,10 +50,8 @@ public static Application Launch(string executable)
5150
/// <summary>
5251
/// Lauches the process and creates and Application object for it
5352
/// </summary>
54-
/// <param name="processStartInfo"></param>
55-
/// <returns></returns>
56-
/// <exception cref="ArgumentNullException"></exception>
57-
/// <exception cref="WhiteException">when some error occured</exception>
53+
/// <exception cref="ArgumentNullException">No process info passed</exception>
54+
/// <exception cref="WhiteException">White Failed to Launch or Attached to process</exception>
5855
public static Application Launch(ProcessStartInfo processStartInfo)
5956
{
6057
if (string.IsNullOrEmpty(processStartInfo.WorkingDirectory)) processStartInfo.WorkingDirectory = ".";
@@ -93,30 +90,27 @@ public static Application Launch(ProcessStartInfo processStartInfo)
9390
}
9491

9592
/// <summary>
96-
/// Creates an Application object for existing process
93+
/// Attaches White to an existing process by process id
9794
/// </summary>
98-
/// <param name="processId"></param>
99-
/// <returns></returns>
100-
/// <exception cref="WhiteException">when process not found</exception>
95+
/// <exception cref="WhiteException">White Failed to Attach to process</exception>
10196
public static Application Attach(int processId)
10297
{
103-
Process process = null;
98+
Process process;
10499
try
105100
{
106101
process = Process.GetProcessById(processId);
107102
}
108-
catch (System.ArgumentException e)
103+
catch (ArgumentException e)
109104
{
110105
throw new WhiteException("Could not find process with id: " + processId, e);
111106
}
112107
return new Application(process);
113108
}
114109

115110
/// <summary>
116-
/// Attaches with existing process
111+
/// Attaches White to an existing process
117112
/// </summary>
118-
/// <param name="process"></param>
119-
/// <returns></returns>
113+
/// <exception cref="WhiteException">White Failed to Attach to process</exception>
120114
public static Application Attach(Process process)
121115
{
122116
return new Application(process);
@@ -125,9 +119,7 @@ public static Application Attach(Process process)
125119
/// <summary>
126120
/// Attaches with existing process
127121
/// </summary>
128-
/// <param name="executable"></param>
129-
/// <returns></returns>
130-
/// <exception cref="WhiteException">when process is not found</exception>
122+
/// <exception cref="WhiteException">White Failed to Attach to process with specified name</exception>
131123
public static Application Attach(string executable)
132124
{
133125
Process[] processes = Process.GetProcessesByName(executable);
@@ -142,7 +134,7 @@ public static Application Attach(string executable)
142134
/// <returns></returns>
143135
/// <exception cref="ArgumentException"></exception>
144136
/// <exception cref="ArgumentNullException"></exception>
145-
/// <exception cref="WhiteException">when some error occured</exception>
137+
/// <exception cref="WhiteException">White Failed to Launch or Attach to process</exception>
146138
public static Application AttachOrLaunch(ProcessStartInfo processStartInfo)
147139
{
148140
string processName = ReplaceLast(processStartInfo.FileName, ".exe", string.Empty);
@@ -181,7 +173,7 @@ public virtual ApplicationSession ApplicationSession
181173
/// <param name="title">Title text of window displayed on desktop</param>
182174
/// <param name="option">Option which would be used to initialize the window.</param>
183175
/// <returns></returns>
184-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
176+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
185177
public virtual Window GetWindow(string title, InitializeOption option)
186178
{
187179
WindowSession windowSession = applicationSession.WindowSession(option);
@@ -193,7 +185,7 @@ public virtual Window GetWindow(string title, InitializeOption option)
193185
/// </summary>
194186
/// <param name="title">Title text of window displayed on desktop</param>
195187
/// <returns></returns>
196-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
188+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
197189
public virtual Window GetWindow(string title)
198190
{
199191
return GetWindow(title, InitializeOption.NoCache);
@@ -205,7 +197,7 @@ public virtual Window GetWindow(string title)
205197
/// <param name="searchCriteria"></param>
206198
/// <param name="initializeOption">found window would be initialized with this option</param>
207199
/// <returns></returns>
208-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
200+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
209201
public virtual Window GetWindow(SearchCriteria searchCriteria, InitializeOption initializeOption)
210202
{
211203
WindowSession windowSession = applicationSession.WindowSession(initializeOption);
@@ -253,7 +245,7 @@ public virtual void Kill()
253245
/// All windows belonging to the application
254246
/// </summary>
255247
/// <returns></returns>
256-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
248+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
257249
public virtual List<Window> GetWindows()
258250
{
259251
return windowFactory.DesktopWindows(process, new NoApplicationSession());
@@ -309,7 +301,7 @@ public virtual void WaitWhileBusy()
309301
/// </summary>
310302
/// <param name="match"></param>
311303
/// <param name="initializeOption">option for the window which matches the condition</param>
312-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
304+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
313305
public virtual Window Find(Predicate<string> match, InitializeOption initializeOption)
314306
{
315307
WindowSession windowSession = applicationSession.WindowSession(initializeOption);

src/TestStack.White/Factory/ChildWindowFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected virtual AutomationElement WaitTillFound(Func<AutomationElement> find,
4444
return element;
4545
}
4646

47-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
47+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
4848
internal static Window Create(AutomationElement element, InitializeOption option, WindowSession windowSession)
4949
{
5050
SpecializedWindowFactory specializedWindowFactory = SpecializedWindowFactories.Find(factory => factory.DoesSpecializeInThis(element));

src/TestStack.White/Factory/WindowFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,31 +68,31 @@ public virtual Window SplashWindow(Process process)
6868
return new SplashWindow(element, InitializeOption.NoCache);
6969
}
7070

71-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
71+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
7272
public virtual Window CreateWindow(string title, Process process, InitializeOption option, WindowSession windowSession)
7373
{
7474
var message = string.Format("Couldn't find window with title {0} in process {1}{2}", title, process.Id, ", after waiting for 30 seconds");
7575
var element = WaitTillFound(() => Finder.FindWindow(title, process.Id), message);
7676
return Create(element, option, windowSession);
7777
}
7878

79-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
79+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
8080
public virtual Window CreateWindow(SearchCriteria searchCriteria, Process process, InitializeOption option, WindowSession windowSession)
8181
{
8282
var message = string.Format("Couldn't find window with SearchCriteria {0} in process {1}{2}", searchCriteria, process.Id, Constants.BusyMessage);
8383
var element = WaitTillFound(() => Finder.FindWindow(searchCriteria, process.Id), message);
8484
return Create(element, option, windowSession);
8585
}
8686

87-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
87+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
8888
public virtual Window FindWindow(Process process, Predicate<string> match, InitializeOption initializeOption, WindowSession windowSession)
8989
{
9090
string message = string.Format("Could not find window matching condition. ProcessName: {0}, ProcessId: {1}, MatchingConditionMethod: {2}, MatchingConditionTarget: {3}", process.ProcessName, process.Id, match.Method, match.Target);
9191
var foundElement = WaitTillFound(() => FindWindowElement(process, match), message);
9292
return Create(foundElement, initializeOption, windowSession);
9393
}
9494

95-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
95+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
9696
public virtual Window FindModalWindow(string title, Process process, InitializeOption option, AutomationElement parentWindowElement,
9797
WindowSession windowSession)
9898
{
@@ -102,7 +102,7 @@ public virtual Window FindModalWindow(string title, Process process, InitializeO
102102
return Create(modalWindowElement, option, windowSession);
103103
}
104104

105-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
105+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
106106
public virtual Window FindModalWindow(SearchCriteria searchCriteria, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession)
107107
{
108108
var windowFinder = new AutomationElementFinder(parentWindowElement);
@@ -137,7 +137,7 @@ private AutomationElement FindWindowElement(Process process, Predicate<string> m
137137
});
138138
}
139139

140-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception>
140+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception>
141141
public virtual List<Window> DesktopWindows()
142142
{
143143
var windows = new List<Window>();

src/TestStack.White/UIItems/DateFormat.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace TestStack.White.UIItems
1010
/// </summary>
1111
public class DateFormat
1212
{
13-
public static DateFormat dayMonthYear = new DateFormat(DateUnit.Day, DateUnit.Month, DateUnit.Year);
14-
public static DateFormat dayYearMonth = new DateFormat(DateUnit.Day, DateUnit.Year, DateUnit.Month);
15-
public static DateFormat monthDayYear = new DateFormat(DateUnit.Month, DateUnit.Day, DateUnit.Year);
16-
public static DateFormat monthYearDay = new DateFormat(DateUnit.Month, DateUnit.Year, DateUnit.Day);
17-
public static DateFormat yearMonthDay = new DateFormat(DateUnit.Year, DateUnit.Month, DateUnit.Day);
18-
public static DateFormat yearDayMonth = new DateFormat(DateUnit.Year, DateUnit.Day, DateUnit.Month);
13+
public static DateFormat DayMonthYear = new DateFormat(DateUnit.Day, DateUnit.Month, DateUnit.Year);
14+
public static DateFormat DayYearMonth = new DateFormat(DateUnit.Day, DateUnit.Year, DateUnit.Month);
15+
public static DateFormat MonthDayYear = new DateFormat(DateUnit.Month, DateUnit.Day, DateUnit.Year);
16+
public static DateFormat MonthYearDay = new DateFormat(DateUnit.Month, DateUnit.Year, DateUnit.Day);
17+
public static DateFormat YearMonthDay = new DateFormat(DateUnit.Year, DateUnit.Month, DateUnit.Day);
18+
public static DateFormat YearDayMonth = new DateFormat(DateUnit.Year, DateUnit.Day, DateUnit.Month);
1919

2020
private readonly List<DateUnit> dateUnits = new List<DateUnit>();
2121

@@ -49,7 +49,7 @@ public static DateFormat Create(string dateSeparator, string pattern)
4949
return dateFormat;
5050
}
5151

52-
/// <summary>
52+
/// <summary>
5353
/// Use ',' as separator.
5454
/// </summary>
5555
public static DateFormat Parse(string @string)

src/TestStack.White/UIItems/IUIItem.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,4 @@ public interface IUIItem : ActionListener
9595

9696
void Enter(string value);
9797
}
98-
99-
/// <summary>
100-
/// Class which inherits this interface has a mapping to it's Automation type.
101-
/// Used for search constraints.
102-
/// </summary>
103-
public interface IMappableUIItem
104-
{
105-
106-
}
10798
}

src/TestStack.White/UIItems/WindowItems/Window.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public override VerticalSpan VerticalSpan
424424
/// Recursively gets all the descendant windows.
425425
/// </summary>
426426
/// <returns></returns>
427-
/// <exception cref="UIItemSearchException">if your framework is not supported</exception> // from ChildWindowFactory.Create
427+
/// <exception cref="UIItemSearchException">The application type is not supported by White</exception> // from ChildWindowFactory.Create
428428
public virtual List<Window> ModalWindows()
429429
{
430430
var finder = new AutomationElementFinder(automationElement);

0 commit comments

Comments
 (0)