From 17612c08da93c75d4c941a643bc7602c18f351d8 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Sat, 23 Feb 2019 20:15:36 +0200 Subject: Implemented auto DTO generation. Implemented mapping of DTO <=> Observables. Organization of unit tests. Removed DELETED from ADDRESS & CONTACT. --- .../MachineStudio/MachineStudio_TST.cs | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 Software/Visual_Studio/Tango.UnitTesting/MachineStudio/MachineStudio_TST.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting/MachineStudio') diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineStudio/MachineStudio_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineStudio/MachineStudio_TST.cs new file mode 100644 index 000000000..b8c374d4f --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineStudio/MachineStudio_TST.cs @@ -0,0 +1,147 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Automation; +using TestStack.White; +using TestStack.White.Factory; +using TestStack.White.UIItems; +using TestStack.White.UIItems.Finders; +using TestStack.White.UIItems.ListBoxItems; +using TestStack.White.UIItems.WindowItems; +using TestStack.White.WindowsAPI; + +namespace Tango.UnitTesting.MachineStudio +{ + public static class AutomationExtensions + { + public static T GetByAutomationId(this Window window, String id) where T : IUIItem + { + return window.Get(SearchCriteria.ByAutomationId(id)); + } + } + + [TestClass] + [TestCategory("Machine Studio")] + public class MachineStudio_TST + { + private Window GetMachineStudioWindow() + { + var app = Application.AttachOrLaunch(new System.Diagnostics.ProcessStartInfo() { FileName = Helper.GetMachineStudioPath() }); + var window = app.GetWindow("Tango", InitializeOption.NoCache); + return window; + } + + private Window GetCurrentDialogWindow() + { + var app = Application.AttachOrLaunch(new System.Diagnostics.ProcessStartInfo() { FileName = Helper.GetMachineStudioPath() }); + return app.GetWindows().LastOrDefault(x => x.IsModal); + } + + private void Kill(int delay = 4000) + { + Thread.Sleep(delay); + var app = Application.AttachOrLaunch(new System.Diagnostics.ProcessStartInfo() { FileName = Helper.GetMachineStudioPath() }); + app.Kill(); + } + + private void Wait(int delay = 1000) + { + Thread.Sleep(delay); + } + + private void ConfirmMessageBox() + { + Wait(); + var dialog = GetCurrentDialogWindow(); + + if (dialog != null) + { + dialog.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN); + } + } + + [TestMethod] + public void Login() + { + var window = GetMachineStudioWindow(); + + window.WaitTill(() => window.GetByAutomationId