12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.IO;
- using System.Reflection;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using TestStack.White;
- using TestStack.White.UIItems;
- using TestStack.White.UIItems.WindowItems;
- using TestStack.White.UIItems.Finders;
- using System.Threading;
- namespace WhiteTests
- {
- [TestClass]
- public class UITest
- {
- private TestStack.White.Application application;
- public void setupapp()
- {
- string outputDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- string editedDir = outputDir.Replace("WhiteTests", "SketchAssistantWPF");
- string app_path = editedDir + @"\SketchAssistantWPF.exe";
- application = Application.Launch(app_path);
- Window mainWindow = application.GetWindow("Sketch Assistant");
- }
- [TestMethod]
- public void CreateCanvasTest()
- {
- setupapp();
- Window mainWindow = application.GetWindow("Sketch Assistant");
- Thread.Sleep(100);
- Assert.AreEqual("none", mainWindow.Get<TextBox>(SearchCriteria.ByAutomationId("LAST_ACTION_TAKEN_BOX")).Text.ToString());
- mainWindow.Get<Button>(SearchCriteria.ByAutomationId("CANVAS_BUTTON")).Click();
- Thread.Sleep(100);
- Assert.AreEqual("Last Action: A new canvas was created.", mainWindow.Get<TextBox>(SearchCriteria.ByAutomationId("LAST_ACTION_TAKEN_BOX")).Text.ToString());
- mainWindow.Close();
- }
- }
- }
|