diff --git a/.gitignore b/.gitignore index 098d4d74..a6f4764f 100644 --- a/.gitignore +++ b/.gitignore @@ -106,4 +106,5 @@ packages # our output folder for build artifacts build -Thumbs.db \ No newline at end of file +Thumbs.db +/src/.vs/config/applicationhost.config diff --git a/appveyor.yml b/appveyor.yml index 13e9692a..100ad7dc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,15 +18,9 @@ build_script: - cmd: msbuild src\TestStack.White.sln "/p:Configuration=%CONFIGURATION%;Platform=%PLATFORM%" - - cmd: ECHO GitLink src\ -u https://github.com/TestStack/White -c %CONFIGURATION% -ignore WinformsTodo,WpfTodo,WpfTodo.UITests,Todo.Core,TestSilverlightApplication,TestSilverlightApplication.Web,WindowsFormsTestApplication,WinFormsTestApp.Old,WPFTestApp.Old,WpfTestApplication,TestStack.White.Reporting,TestStack.White.ScreenObjects,TestStack.White.ScreenObjects.UITests,TestStack.White.UITests,TestStack.White.UnitTests,TestStack.White.WebBrowser,TestStack.White.WebBrowser.UITests,TestStack.White.WebBrowser.UnitTests - - cmd: GitLink . -u https://github.com/TestStack/White -c %CONFIGURATION% -ignore WinformsTodo,WpfTodo,WpfTodo.UITests,Todo.Core,TestSilverlightApplication,TestSilverlightApplication.Web,WindowsFormsTestApplication,WinFormsTestApp.Old,WPFTestApp.Old,WpfTestApplication,TestStack.White.Reporting,TestStack.White.ScreenObjects,TestStack.White.ScreenObjects.UITests,TestStack.White.UITests,TestStack.White.UnitTests,TestStack.White.WebBrowser,TestStack.White.WebBrowser.UITests,TestStack.White.WebBrowser.UnitTests - - cmd: ECHO nuget pack nuget\TestStack.White.nuspec -version "%GitVersion_NuGetVersion%" -prop "configuration=%CONFIGURATION%" - cmd: nuget pack nuget\TestStack.White.nuspec -version "%GitVersion_NuGetVersion%" -prop "configuration=%CONFIGURATION%" - cmd: appveyor PushArtifact "TestStack.White.%GitVersion_NuGetVersion%.nupkg" -on_finish: - - ps: if (Test-Path -path c:\FailedTestsScreenshots) { Get-ChildItem c:\FailedTestsScreenshots\*.* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }} - cache: - - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified \ No newline at end of file + - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified diff --git a/src/Samples/Todo.Core/ITaskRepository.cs b/src/Samples/Todo.Core/ITaskRepository.cs index 26654cfc..31fa4e9d 100644 --- a/src/Samples/Todo.Core/ITaskRepository.cs +++ b/src/Samples/Todo.Core/ITaskRepository.cs @@ -1,13 +1,60 @@ -using System.Collections.Generic; -using System.Threading.Tasks; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the ITaskRepository type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace Todo.Core { + using System.Collections.Generic; + using System.Threading.Tasks; + + /// + /// The TaskRepository interface. + /// public interface ITaskRepository { - Task> GetAll(); + /// + /// The add. + /// + /// + /// The to-do item. + /// + /// + /// The . + /// Task Add(TodoItem todoItem); + + /// + /// The delete. + /// + /// + /// The id. + /// + /// + /// The . + /// Task Delete(int id); + + /// + /// The get. + /// + /// + /// The id. + /// + /// + /// The . + /// Task Get(int id); + + /// + /// The get all. + /// + /// + /// The . + /// + Task> GetAll(); } } \ No newline at end of file diff --git a/src/Samples/Todo.Core/InMemoryTaskRepository.cs b/src/Samples/Todo.Core/InMemoryTaskRepository.cs index 55cd1f80..6426fc5b 100644 --- a/src/Samples/Todo.Core/InMemoryTaskRepository.cs +++ b/src/Samples/Todo.Core/InMemoryTaskRepository.cs @@ -1,49 +1,98 @@ -using System.Collections.Generic; -using System.Threading.Tasks; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// In memory repository where all operations take at least 1 second +// +// -------------------------------------------------------------------------------------------------------------------- namespace Todo.Core { + using System.Collections.Generic; + using System.Threading.Tasks; + /// - /// In memory repository where all operations take at least 1 second + /// In memory repository where all operations take at least 1 second /// public class InMemoryTaskRepository : ITaskRepository { + /// + /// The tasks. + /// private readonly Dictionary tasks = new Dictionary(); - private int currentId; - public Task> GetAll() - { - return TaskEx.Delay(1500) - .ContinueWith>(t => tasks.Values); - } + /// + /// The current id. + /// + private int currentId; + /// + /// The add. + /// + /// + /// The to-do item. + /// + /// + /// The . + /// public Task Add(TodoItem todoItem) { - return TaskEx.Delay(1500) - .ContinueWith(t => tasks.Add(currentId++, todoItem)); + return TaskEx.Delay(1500).ContinueWith(t => this.tasks.Add(this.currentId++, todoItem)); } + /// + /// The delete. + /// + /// + /// The id. + /// + /// + /// The . + /// public Task Delete(int id) { - return TaskEx.Delay(1500) - .ContinueWith(t => - { - if (tasks.ContainsKey(id)) - tasks.Remove(id); - }); + return TaskEx.Delay(1500).ContinueWith( + t => + { + if (tasks.ContainsKey(id)) + { + this.tasks.Remove(id); + } + }); } + /// + /// The get. + /// + /// + /// The id. + /// + /// + /// The . + /// public Task Get(int id) { - return TaskEx.Delay(1500) - .ContinueWith(t => - { - if (tasks.ContainsKey(id)) - return tasks[id]; + return TaskEx.Delay(1500).ContinueWith( + t => + { + if (tasks.ContainsKey(id)) + { + return tasks[id]; + } - return null; - }); + return null; + }); + } + /// + /// The get all. + /// + /// + /// The . + /// + public Task> GetAll() + { + return TaskEx.Delay(1500).ContinueWith>(t => this.tasks.Values); } } } \ No newline at end of file diff --git a/src/Samples/Todo.Core/NotifyPropertyChanged.cs b/src/Samples/Todo.Core/NotifyPropertyChanged.cs index 5277bb5e..d0b7db19 100644 --- a/src/Samples/Todo.Core/NotifyPropertyChanged.cs +++ b/src/Samples/Todo.Core/NotifyPropertyChanged.cs @@ -1,15 +1,39 @@ -using System.ComponentModel; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the NotifyPropertyChanged type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace Todo.Core { + using System.ComponentModel; + + /// + /// The notify property changed. + /// public class NotifyPropertyChanged : INotifyPropertyChanged { + /// + /// The property changed. + /// public event PropertyChangedEventHandler PropertyChanged; + /// + /// The on property changed. + /// + /// + /// The property name. + /// protected void OnPropertyChanged(string propertyName) { - var handler = PropertyChanged; - if (handler == null) return; + var handler = this.PropertyChanged; + if (handler == null) + { + return; + } + var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } diff --git a/src/Samples/Todo.Core/Properties/AssemblyInfo.cs b/src/Samples/Todo.Core/Properties/AssemblyInfo.cs index 887ed60c..e03b654e 100644 --- a/src/Samples/Todo.Core/Properties/AssemblyInfo.cs +++ b/src/Samples/Todo.Core/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -23,14 +22,12 @@ [assembly: Guid("1ba903ca-ae6d-418c-a41b-80d8b9c792b4")] // Version information for an assembly consists of the following four values: -// // Major Version // Minor Version // Build Number // Revision -// // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Samples/Todo.Core/TodoItem.cs b/src/Samples/Todo.Core/TodoItem.cs index 6f49d964..5e2c68b9 100644 --- a/src/Samples/Todo.Core/TodoItem.cs +++ b/src/Samples/Todo.Core/TodoItem.cs @@ -1,11 +1,33 @@ -using System; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the TodoItem type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace Todo.Core { + using System; + + /// + /// The to-do item. + /// public class TodoItem : NotifyPropertyChanged { - public string Title { get; set; } + /// + /// Gets or sets the description. + /// public string Description { get; set; } + + /// + /// Gets or sets the due date. + /// public DateTime? DueDate { get; set; } + + /// + /// Gets or sets the title. + /// + public string Title { get; set; } } -} +} \ No newline at end of file diff --git a/src/Samples/Todo.Core/packages.config b/src/Samples/Todo.Core/packages.config index 733fdfaf..0d63eade 100644 --- a/src/Samples/Todo.Core/packages.config +++ b/src/Samples/Todo.Core/packages.config @@ -1,4 +1,5 @@  + diff --git a/src/Samples/WinForms/WinformsTodo/Form1.cs b/src/Samples/WinForms/WinformsTodo/Form1.cs index 47087cf2..cb1428b4 100644 --- a/src/Samples/WinForms/WinformsTodo/Form1.cs +++ b/src/Samples/WinForms/WinformsTodo/Form1.cs @@ -1,12 +1,26 @@ -using System.Windows.Forms; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the Form1 type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace WinformsTodo { + using System.Windows.Forms; + + /// + /// The form 1. + /// public partial class Form1 : Form { + /// + /// Initializes a new instance of the class. + /// public Form1() { - InitializeComponent(); + this.InitializeComponent(); } } -} +} \ No newline at end of file diff --git a/src/Samples/WinForms/WinformsTodo/Program.cs b/src/Samples/WinForms/WinformsTodo/Program.cs index db45722c..0e51eb93 100644 --- a/src/Samples/WinForms/WinformsTodo/Program.cs +++ b/src/Samples/WinForms/WinformsTodo/Program.cs @@ -1,21 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the Program type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace WinformsTodo { - static class Program + using System; + using System.Windows.Forms; + + /// + /// The program. + /// + public static class Program { /// - /// The main entry point for the application. + /// The main entry point for the application. /// [STAThread] - static void Main() + public static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } -} +} \ No newline at end of file diff --git a/src/Samples/WinForms/WinformsTodo/Properties/AssemblyInfo.cs b/src/Samples/WinForms/WinformsTodo/Properties/AssemblyInfo.cs index 3a8b9abf..bd74d14d 100644 --- a/src/Samples/WinForms/WinformsTodo/Properties/AssemblyInfo.cs +++ b/src/Samples/WinForms/WinformsTodo/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -23,14 +22,12 @@ [assembly: Guid("4747c87d-9410-49e1-a7bb-f85c49b6dc4e")] // Version information for an assembly consists of the following four values: -// // Major Version // Minor Version // Build Number // Revision -// // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Samples/WinForms/WinformsTodo/Properties/Settings.settings b/src/Samples/WinForms/WinformsTodo/Properties/Settings.settings index 39645652..e04fc631 100644 --- a/src/Samples/WinForms/WinformsTodo/Properties/Settings.settings +++ b/src/Samples/WinForms/WinformsTodo/Properties/Settings.settings @@ -1,7 +1,8 @@  + - + \ No newline at end of file diff --git a/src/Samples/WinForms/WinformsTodo/app.config b/src/Samples/WinForms/WinformsTodo/app.config index 0a1d6288..63d028c3 100644 --- a/src/Samples/WinForms/WinformsTodo/app.config +++ b/src/Samples/WinForms/WinformsTodo/app.config @@ -1,4 +1,5 @@  + diff --git a/src/Samples/Wpf/WpfTodo.UITests/Properties/AssemblyInfo.cs b/src/Samples/Wpf/WpfTodo.UITests/Properties/AssemblyInfo.cs index 90ee50a0..a4382d17 100644 --- a/src/Samples/Wpf/WpfTodo.UITests/Properties/AssemblyInfo.cs +++ b/src/Samples/Wpf/WpfTodo.UITests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -23,14 +22,12 @@ [assembly: Guid("42a7fca7-ffb4-427b-abaf-baab23d5ccdd")] // Version information for an assembly consists of the following four values: -// // Major Version // Minor Version // Build Number // Revision -// // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/src/Samples/Wpf/WpfTodo.UITests/Screens/NewTaskScreen.cs b/src/Samples/Wpf/WpfTodo.UITests/Screens/NewTaskScreen.cs index be521009..1cf08811 100644 --- a/src/Samples/Wpf/WpfTodo.UITests/Screens/NewTaskScreen.cs +++ b/src/Samples/Wpf/WpfTodo.UITests/Screens/NewTaskScreen.cs @@ -1,32 +1,64 @@ -using System; -using System.Windows.Automation; -using TestStack.White.ScreenObjects; -using TestStack.White.UIItems; -using TestStack.White.UIItems.Finders; -using TestStack.White.UIItems.WindowItems; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the NewTaskScreen type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace WpfTodo.UITests.Screens { + using System; + using System.Windows.Automation; + + using TestStack.White.ScreenObjects; + using TestStack.White.UIItems; + using TestStack.White.UIItems.Finders; + using TestStack.White.UIItems.WindowItems; + + /// + /// The new task screen. + /// public class NewTaskScreen : Screen { - protected Button CreateButton; + /// + /// The create button. + /// + private readonly Button createButton = null; - public NewTaskScreen(Window window, ScreenRepository screenRepository) : base(window, screenRepository) - { - } - - public virtual string Title + /// + /// Initializes a new instance of the class. + /// + /// + /// The window. + /// + /// + /// The screen repository. + /// + public NewTaskScreen(Window window, ScreenRepository screenRepository) + : base(window, screenRepository) { - get { return Window.Get("Title").Text; } - set { Window.Get("Title").Text = value; } } + /// + /// Gets or sets the description. + /// public virtual string Description { - get { return Window.Get("Description").Text; } - set { Window.Get("Description").Text = value; } + get + { + return Window.Get("Description").Text; + } + + set + { + Window.Get("Description").Text = value; + } } + /// + /// Gets or sets the due date. + /// public virtual DateTime DueDate { get @@ -35,6 +67,7 @@ public virtual DateTime DueDate var currentPropertyValue = uiItem.AutomationElement.GetCurrentPropertyValue(ValuePattern.ValueProperty); return (DateTime)currentPropertyValue; } + set { var uiItem = Window.Get(SearchCriteria.ByAutomationId("DueDate")); @@ -42,10 +75,29 @@ public virtual DateTime DueDate } } + /// + /// Gets or sets the title. + /// + public virtual string Title + { + get + { + return Window.Get("Title").Text; + } + + set + { + Window.Get("Title").Text = value; + } + } + + /// + /// The create. + /// public virtual void Create() { - CreateButton.Click(); - WaitWhileBusy(); + this.createButton.Click(); + this.WaitWhileBusy(); } } } \ No newline at end of file diff --git a/src/Samples/Wpf/WpfTodo.UITests/Screens/Screen.cs b/src/Samples/Wpf/WpfTodo.UITests/Screens/Screen.cs index 03322425..ede85e91 100644 --- a/src/Samples/Wpf/WpfTodo.UITests/Screens/Screen.cs +++ b/src/Samples/Wpf/WpfTodo.UITests/Screens/Screen.cs @@ -1,26 +1,58 @@ -using System; -using System.Windows.Automation; -using TestStack.White.ScreenObjects; -using TestStack.White.UIItems.WindowItems; -using TestStack.White.Utility; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the Screen type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace WpfTodo.UITests.Screens { + using System; + using System.Windows.Automation; + + using TestStack.White.ScreenObjects; + using TestStack.White.UIItems.WindowItems; + using TestStack.White.Utility; + + /// + /// The screen. + /// public class Screen : AppScreen { - public Screen(Window window, ScreenRepository screenRepository) : base(window, screenRepository) + /// + /// Initializes a new instance of the class. + /// + /// + /// The window. + /// + /// + /// The screen repository. + /// + protected Screen(Window window, ScreenRepository screenRepository) + : base(window, screenRepository) { } - public virtual void WaitWhileBusy() + /// + /// The shell is busy. + /// + /// + /// The . + /// + public bool ShellIsBusy() { - Retry.For(ShellIsBusy, isBusy => isBusy, TimeSpan.FromSeconds(30)); + var currentPropertyValue = + Window.AutomationElement.GetCurrentPropertyValue(AutomationElement.HelpTextProperty); + return currentPropertyValue != null && ((string)currentPropertyValue).Contains("Busy"); } - bool ShellIsBusy() + /// + /// The wait while busy. + /// + protected virtual void WaitWhileBusy() { - var currentPropertyValue = Window.AutomationElement.GetCurrentPropertyValue(AutomationElement.HelpTextProperty); - return currentPropertyValue != null && ((string)currentPropertyValue).Contains("Busy"); + Retry.For(this.ShellIsBusy, isBusy => isBusy, TimeSpan.FromSeconds(30)); } } } \ No newline at end of file diff --git a/src/Samples/Wpf/WpfTodo.UITests/Screens/TodoWindow.cs b/src/Samples/Wpf/WpfTodo.UITests/Screens/TodoWindow.cs index b0bd4ff6..4a2f03c0 100644 --- a/src/Samples/Wpf/WpfTodo.UITests/Screens/TodoWindow.cs +++ b/src/Samples/Wpf/WpfTodo.UITests/Screens/TodoWindow.cs @@ -1,46 +1,89 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using TestStack.White.Factory; -using TestStack.White.ScreenObjects; -using TestStack.White.UIItems; -using TestStack.White.UIItems.Finders; -using TestStack.White.UIItems.ListBoxItems; -using TestStack.White.UIItems.WindowItems; -using TestStack.White.UIItems.WPFUIItems; -using Todo.Core; - +// -------------------------------------------------------------------------------------------------------------------- +// +// All rights reserved. +// +// +// Defines the TodoWindow type. +// +// -------------------------------------------------------------------------------------------------------------------- namespace WpfTodo.UITests.Screens { + using System; + using System.Collections.Generic; + using System.Linq; + + using TestStack.White.Factory; + using TestStack.White.ScreenObjects; + using TestStack.White.UIItems; + using TestStack.White.UIItems.Finders; + using TestStack.White.UIItems.ListBoxItems; + using TestStack.White.UIItems.WindowItems; + using TestStack.White.UIItems.WPFUIItems; + + using Todo.Core; + + /// + /// The to-do window. + /// public class TodoWindow : Screen { - protected ListBox TasksList; - protected Button AddTaskButton; + /// + /// The add task button. + /// + private readonly Button addTaskButton = null; + + /// + /// The tasks list. + /// + private readonly ListBox tasksList = null; - public TodoWindow(Window window, ScreenRepository screenRepository) : base(window, screenRepository) + /// + /// Initializes a new instance of the class. + /// + /// + /// The window. + /// + /// + /// The screen repository. + /// + public TodoWindow(Window window, ScreenRepository screenRepository) + : base(window, screenRepository) { } + /// + /// Gets the tasks. + /// public virtual IEnumerable Tasks { get { - WaitWhileBusy(); - return from ListItem item in TasksList.Items - select new TodoItem - { - Title = item.Get