Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(bool)

Here are the examples of the csharp api Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

845 Examples 7

19 View Source File : ToggleButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Size()
        {
            replacedert.IsTrue(toggleButtonElement.Size.Width > 0);
            replacedert.IsTrue(toggleButtonElement.Size.Height > 0);
        }

19 View Source File : Screenshot.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetScreenshot()
        {
            WindowsDriver<WindowsElement> notepadSession = null;
            WindowsDriver<WindowsElement> desktopSession = null;

            try
            {
                // Launch and capture a screenshot of a maximized Notepad application. The steps below intentionally use
                // the Notepad application window to fully cover the Alarms & Clock application. This setup demonstrates
                // that capturing Alarms & Clock screenshot afterward will implicitly bring its window to foreground.
                notepadSession = Utility.CreateNewSession(CommonTestSettings.NotepadAppId);
                notepadSession.Manage().Window.Maximize();
                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
                OpenQA.Selenium.Screenshot notepadScreenshot = notepadSession.GetScreenshot();

                // Capture a screenshot of Alarms & Clock application
                // This implicitly brings the application window to foreground
                OpenQA.Selenium.Screenshot alarmsClockScreenshot = session.GetScreenshot();

                // Save the application screenshot capture locally on the machine running the test
                alarmsClockScreenshot.SaveAsFile(@"ScreenshotAlarmsClockApplication.png", ScreenshotImageFormat.Png);

                // Capture the entire desktop using the Desktop session
                desktopSession = Utility.CreateNewSession(CommonTestSettings.DesktopAppId);
                OpenQA.Selenium.Screenshot desktopScreenshot = desktopSession.GetScreenshot();

                // Save the desktop screenshot capture locally on the machine running the test
                desktopScreenshot.SaveAsFile(@"ScreenshotDesktop.png", ScreenshotImageFormat.Png);

                using (MemoryStream msScreenshot1 = new MemoryStream(alarmsClockScreenshot.AsByteArray))
                using (MemoryStream msScreenshot2 = new MemoryStream(notepadScreenshot.AsByteArray))
                using (MemoryStream msScreenshot3 = new MemoryStream(desktopScreenshot.AsByteArray))
                {
                    // Verify that the Alarms & Clock application screenshot has a valid size
                    Image screenshotImage1 = Image.FromStream(msScreenshot1);
                    replacedert.AreEqual(session.Manage().Window.Size.Height, screenshotImage1.Height);
                    replacedert.AreEqual(session.Manage().Window.Size.Width, screenshotImage1.Width);

                    // Verify that the maximized Notepad application screenshot has a valid size
                    Image screenshotImage2 = Image.FromStream(msScreenshot2);
                    replacedert.AreEqual(notepadSession.Manage().Window.Size.Height, screenshotImage2.Height);
                    replacedert.AreEqual(notepadSession.Manage().Window.Size.Width, screenshotImage2.Width);

                    // Verify that the application screenshot is smaller in size compared to the entire desktop
                    Image screenshotImage3 = Image.FromStream(msScreenshot3);
                    replacedert.IsTrue(screenshotImage2.Height >= screenshotImage1.Height);
                    replacedert.IsTrue(screenshotImage2.Width >= screenshotImage1.Width);
                }
            }
            finally
            {
                if (notepadSession != null)
                {
                    notepadSession.Quit();
                }

                if (desktopSession != null)
                {
                    desktopSession.Quit();
                }
            }
        }

19 View Source File : ProductsTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void Product_ClearAll()
        {
            var proxy = CreateApiProxy();
            var clearResponse = proxy.ProductsClearAll(100);
            CheckErrors(clearResponse);
            replacedert.IsTrue(clearResponse.Content.ProductsCleared > 0);
        }

19 View Source File : TextBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            replacedert.IsTrue(textBoxElement2.LocationOnScreenOnceScrolledIntoView.X >= textBoxElement1.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(textBoxElement2.LocationOnScreenOnceScrolledIntoView.Y >= textBoxElement1.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : ComboBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            replacedert.IsTrue(comboBoxElement2.LocationOnScreenOnceScrolledIntoView.X >= comboBoxElement1.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(comboBoxElement2.LocationOnScreenOnceScrolledIntoView.Y >= comboBoxElement1.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : ProductInventoryTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void ProductInventory_TestFindForProduct()
        {
            var proxy = CreateApiProxy();

            var findResponse = proxy.ProductInventoryFindForProduct(TestConstants.TestProductBvin);

            replacedert.IsTrue(findResponse.Content.Count > 0);

            CheckErrors(findResponse);
        }

19 View Source File : ElementElements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindNestedElements_ByRuntimeId()
        {
            var elements = alarmTabElement.FindElementsById(alarmTabElement.Id);
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(1, elements.Count);
            replacedert.IsTrue(elements.Contains(alarmTabElement));
        }

19 View Source File : LexiconTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanFindWord()
        {
            string input = "thi";
			string culture = "en-US";

			Lexicon lex = new Lexicon(new StaticLexicon());
			long expected = lex.AddOrCreateWord(input, culture);
            replacedert.IsTrue(expected > 0);

			long actual = lex.FindWordId(input, culture);
            replacedert.AreEqual(expected, actual);
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void MaximizeWindow()
        {
            WindowTransformSession.Manage().Window.Maximize();
            var windowSize = WindowTransformSession.Manage().Window.Size;
            replacedert.IsNotNull(windowSize);
            replacedert.IsTrue(OriginalSize.Height <= windowSize.Height);
            replacedert.IsTrue(OriginalSize.Width <= windowSize.Width);
            replacedert.IsTrue(WindowTransformSession.FindElementByAccessibilityId("Maximize").Text.Contains("Restore"));
        }

19 View Source File : SearcherTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanFindObjectById()
        {
			SearchObject s = new SearchObject();
            s.ObjectType = 0;
            s.ObjectId = "1234";

			Lexicon lexicon = new Lexicon(new StaticLexicon());
			Searcher searcher = new Searcher(lexicon, new StaticSearcher());

            long id = searcher.ObjectIndexAddOrUpdate(s);

            replacedert.IsTrue(id > 0);

			SearchObject actual = searcher.ObjectIndexFind(id);
            replacedert.IsNotNull(actual);
            replacedert.AreEqual(id, actual.Id);
            replacedert.AreEqual(s.ObjectType, actual.ObjectType);
            replacedert.AreEqual(s.ObjectId, actual.ObjectId);
        }

19 View Source File : TextBox.cs
License : MIT License
Project Creator : kfrajtak

[ClreplacedInitialize]
        public static void ClreplacedInitialize(TestContext context)
        {
            Setup(context);
            NavigateTo("Text controls", "TextBox");

            // Locate the first 2 TextBox in the page and skip the search TextBox on the app bar
            var textBoxes = session.FindElementsByClreplacedName("TextBox");
            replacedert.IsTrue(textBoxes.Count > 2);
            textBoxElement1 = textBoxes[1];
            textBoxElement2 = textBoxes[2];
            replacedert.IsNotNull(textBoxElement1);
            replacedert.IsNotNull(textBoxElement2);
        }

19 View Source File : RadioButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            replacedert.IsTrue(radioButtonElement2.LocationOnScreenOnceScrolledIntoView.X >= radioButtonElement1.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(radioButtonElement2.LocationOnScreenOnceScrolledIntoView.Y >= radioButtonElement1.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : ProductFilesTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        [Deploymenreplacedem(@"Data\ProductImage.jpg", "Data")]
        public void ProductFiles_CreateUpdateDelete()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Create Product File.
            var productfile = new ProductFileDTO
            {
                FileName = "Test" + DateTime.Now.ToString("yyyyMMddHHmmss"),
                MaxDownloads = 5,
                ShortDescription = "My test file for product",
                ProductId = TestConstants.TestProductBvin,
                StoreId = 1,
                AvailableMinutes = 20
            };
            var createResponse = proxy.ProductFilesCreate(productfile);
            CheckErrors(createResponse);
            replacedert.IsFalse(string.IsNullOrEmpty(createResponse.Content.Bvin));

            //Update product file.
            createResponse.Content.ShortDescription = createResponse.Content.ShortDescription + "updated";
            var updateResponse = proxy.ProductFilesUpdate(createResponse.Content);
            CheckErrors(updateResponse);
            replacedert.AreEqual(createResponse.Content.ShortDescription, updateResponse.Content.ShortDescription);

            //Find product file.
            var findResponse = proxy.ProductFilesFind(createResponse.Content.Bvin);
            CheckErrors(findResponse);
            replacedert.AreEqual(updateResponse.Content.MaxDownloads, findResponse.Content.MaxDownloads);


            //Upload product file first part.
            var imagePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data/ProductImage.jpg");
            var imageData = File.ReadAllBytes(imagePath);
            var firstPartData = new byte[imageData.Length/2];
            var secondPart = new byte[imageData.Length/2];
            Array.Copy(imageData, 0, firstPartData, 0, imageData.Length/2);
            Array.Copy(imageData, imageData.Length/2, firstPartData, 0, imageData.Length/2);
            var firstPartResponse = proxy.ProductFilesDataUploadFirstPart(findResponse.Content.Bvin, "ProductImage.jpg",
                "Test UPload", firstPartData);
            replacedert.IsTrue(firstPartResponse.Content);

            //Upload product file second part
            var secondPartResponse = proxy.ProductFilesDataUploadAdditionalPart(findResponse.Content.Bvin,
                "ProductImage.jpg", secondPart);
            replacedert.IsTrue(firstPartResponse.Content);

            //Add file to product.
            var addfileToProductResponse = proxy.ProductFilesAddToProduct(TestConstants.TestProductBvin,
                findResponse.Content.Bvin, 5, 10);
            replacedert.IsTrue(addfileToProductResponse.Content);

            //Find product files for Product
            var findforProductResponse = proxy.ProductFilesFindForProduct(TestConstants.TestProductBvin);
            CheckErrors(findforProductResponse);
            replacedert.IsTrue(findforProductResponse.Content.Count > 0);

            //Remove product files for Product
            var removefileToProductResponse = proxy.ProductFilesRemoveFromProduct(TestConstants.TestProductBvin,
                findResponse.Content.Bvin);
            replacedert.IsTrue(removefileToProductResponse.Content);

            //Delete product file
            var deleteResponse = proxy.ProductFilesDelete(findResponse.Content.Bvin);
            replacedert.IsTrue(deleteResponse.Content);
        }

19 View Source File : ToggleButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Location()
        {
            var disableButtonCheckbox = session.FindElementByAccessibilityId("DisableToggle1");
            replacedert.IsTrue(toggleButtonElement.Location.X >= disableButtonCheckbox.Location.X);
            replacedert.IsTrue(toggleButtonElement.Location.Y >= disableButtonCheckbox.Location.Y);
        }

19 View Source File : SetupWizardTest3.cs
License : MIT License
Project Creator : HotcakesCommerce

public void DeleteZoneArea()
        {
            #region Arrange
            var zone0 = _irepo.GetDeleteZoneArea();
            var zone1 = _application.OrderServices.ShippingZones.FindForStore(_application.CurrentStore.Id).FirstOrDefault(x => x.Name.Equals(zone0.Name));
            if (zone1 == null) replacedert.AreEqual(0, 1);

            var removezone = _application.OrderServices.ShippingZones.FindForStore(_application.CurrentStore.Id)
                             .FirstOrDefault(x => x.Name.Equals(zone0.Name));
            var removezonearea = removezone.Areas.FirstOrDefault(x => x.CountryIsoAlpha3.Equals(zone0.Areas.FirstOrDefault().CountryIsoAlpha3));

            #endregion
            #region Act
            _application.OrderServices.ShippingZoneRemoveArea(removezone.Id, removezonearea.CountryIsoAlpha3,
                                                                removezonearea.RegionAbbreviation);


            var resultarea = _application.OrderServices.ShippingZones.FindForStore(_application.CurrentStore.Id)
                             .FirstOrDefault(x => x.Name.Equals(zone0.Name)).Areas.FirstOrDefault(x => x.CountryIsoAlpha3.Equals(zone0.Areas.FirstOrDefault().CountryIsoAlpha3));

            #endregion

            //replacedert
            replacedert.IsTrue(resultarea == null);

        }

19 View Source File : ElementElements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindNestedElements_ByAccessibilityId()
        {
            var elements = alarmTabElement.FindElementsByAccessibilityId(AlarmTabAutomationId);
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(1, elements.Count);
            replacedert.IsTrue(elements.Contains(alarmTabElement));
        }

19 View Source File : ProductPropertiesTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void ProductProperty_FindPropertyByProduct()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Find all product properties for specific product
            var response = proxy.ProductPropertiesForProduct("EBF3029C-D673-49DA-958A-432C65B16D4C");

            if (response.Content == null)
            {
                replacedert.IsTrue(response.Errors[0].Description == "No product properties found.");
            }
            else
            {
                CheckErrors(response);
            }
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElements_ByRuntimeId()
        {
            var elements = session.FindElementsById(alarmTabElement.Id);
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(1, elements.Count);
            replacedert.IsTrue(elements.Contains(alarmTabElement));
        }

19 View Source File : GiftCardRepositoryTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void GiftCard_NumberGeneration()
        {
            //HccAppHelper.IsForMemoryOnly = true;
            var format = "GIFT-XXXX-XXXX-XXXX-XXXX-XXXX";
            var app = CreateHccAppInMemory();
            app.CurrentStore.Settings.GiftCard.CardNumberFormat = format;

            var number = app.CatalogServices.GenerateGiftCardNumber();

            replacedert.IsNotNull(number);
            replacedert.AreNotSame(format, number);
            replacedert.AreEqual(format.Length, number.Length);
            replacedert.IsTrue(number.StartsWith("GIFT-"));
            replacedert.IsTrue(char.IsDigit(number[5]));

            var number2 = app.CatalogServices.GenerateGiftCardNumber();

            replacedert.AreNotSame(number, number2);

            app.CurrentStore.Settings.GiftCard.UseAZSymbols = true;

            var number3 = app.CatalogServices.GenerateGiftCardNumber();
        }

19 View Source File : TouchDownMoveUp.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void TouchDownMoveUp_DragAndDrop()
        {
            WindowsElement appNamereplacedle = session.FindCalculatorreplacedleByAccessibilityId();
            Point replacedleBarLocation = new Point(appNamereplacedle.Location.X + appNamereplacedle.Size.Width / 2, appNamereplacedle.Location.Y + appNamereplacedle.Size.Height / 2);
            const int offset = 100;

            // Save application window original position
            Point originalPosition = session.Manage().Window.Position;
            replacedert.IsNotNull(originalPosition);

            // Send touch down, move, and up actions combination to perform a drag and drop 
            // action on the app replacedle bar. These actions reposition Calculator window.
            touchScreen.Down(replacedleBarLocation.X, replacedleBarLocation.Y);
            touchScreen.Move(replacedleBarLocation.X + offset, replacedleBarLocation.Y + offset);
            touchScreen.Up(replacedleBarLocation.X + offset, replacedleBarLocation.Y + offset);
            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Verify that application window is now re-positioned from the original location
            replacedert.AreNotEqual(originalPosition, session.Manage().Window.Position);
            replacedert.IsTrue(originalPosition.Y < session.Manage().Window.Position.Y);

            // Restore application window original position
            session.Manage().Window.Position = originalPosition;
            replacedert.AreEqual(originalPosition, session.Manage().Window.Position);
        }

19 View Source File : Button.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            var disableButtonCheckbox = session.FindElementByAccessibilityId("DisableButton1");
            replacedert.IsTrue(buttonElement.LocationOnScreenOnceScrolledIntoView.X >= disableButtonCheckbox.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(buttonElement.LocationOnScreenOnceScrolledIntoView.Y >= disableButtonCheckbox.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : ComboBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Location()
        {
            replacedert.IsTrue(comboBoxElement2.Location.X >= comboBoxElement1.Location.X);
            replacedert.IsTrue(comboBoxElement2.Location.Y >= comboBoxElement1.Location.Y);
        }

19 View Source File : SearcherTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanAddObject()
        {
			SearchObject s = new SearchObject();
            s.ObjectType = 0;
            s.ObjectId = "1234";

			Lexicon lexicon = new Lexicon(new StaticLexicon());
			Searcher searcher = new Searcher(lexicon, new StaticSearcher());

            long id = searcher.ObjectIndexAddOrUpdate(s);

            replacedert.IsTrue(id > 0);

        }

19 View Source File : ComboBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Size()
        {
            replacedert.IsTrue(comboBoxElement1.Size.Width > 0);
            replacedert.IsTrue(comboBoxElement1.Size.Height > 0);
            replacedert.IsTrue(comboBoxElement2.Size.Width >= comboBoxElement1.Size.Width);
            replacedert.IsTrue(comboBoxElement2.Size.Height >= comboBoxElement1.Size.Height);
        }

19 View Source File : SearcherTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanRecordObjectWord()
        {
			string culture = "en-US";

            // Setup 
			SearchObject s = new SearchObject();
            s.ObjectType = 0;
            s.ObjectId = "1234";

			Lexicon lexicon = new Lexicon(new StaticLexicon());
			long wordId = lexicon.AddOrCreateWord("thi", culture);
            replacedert.IsTrue(wordId > 0);

			Searcher searcher = new Searcher(lexicon, new StaticSearcher());
            long id = searcher.ObjectIndexAddOrUpdate(s);
            replacedert.IsTrue(id > 0);

            // Test
			SearchObjectWord w = new SearchObjectWord();
            w.SearchObjectId = id;
            w.WordId = wordId;
            w.Score = 1;

            bool actual = searcher.ObjectWordIndexUpdate(w);
            replacedert.IsTrue(actual);
        }

19 View Source File : TextBlock.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Size()
        {
            replacedert.IsTrue(textBlockElement1.Size.Width > 0);
            replacedert.IsTrue(textBlockElement1.Size.Height > 0);
            replacedert.IsTrue(textBlockElement2.Size.Width >= textBlockElement1.Size.Width);
            replacedert.IsTrue(textBlockElement2.Size.Height >= textBlockElement1.Size.Height);
        }

19 View Source File : RadioButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Size()
        {
            replacedert.IsTrue(radioButtonElement1.Size.Width > 0);
            replacedert.IsTrue(radioButtonElement1.Size.Height > 0);
            replacedert.AreEqual(radioButtonElement1.Size.Width, radioButtonElement2.Size.Width);
            replacedert.AreEqual(radioButtonElement1.Size.Height, radioButtonElement2.Size.Height);
        }

19 View Source File : ApiTestBase.cs
License : MIT License
Project Creator : HotcakesCommerce

protected void CheckErrors<T>(ApiResponse<List<T>> response)
        {
            replacedert.IsTrue(response.Errors.Count == 0);
            replacedert.IsNotNull(response.Content);
            replacedert.IsTrue(response.Content.Count > 0);
        }

19 View Source File : TextBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Location()
        {
            replacedert.IsTrue(textBoxElement2.Location.X >= textBoxElement1.Location.X);
            replacedert.IsTrue(textBoxElement2.Location.Y >= textBoxElement1.Location.Y);
        }

19 View Source File : SearcherTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanDeleteFromIndex()
        {
			SearchObject s = new SearchObject();
            s.ObjectType = 0;
            s.ObjectId = "1234";

			Lexicon lexicon = new Lexicon(new StaticLexicon());
			Searcher searcher = new Searcher(lexicon, new StaticSearcher());

            long id = searcher.ObjectIndexAddOrUpdate(s);

            replacedert.IsTrue(id > 0);

			SearchObject actual = searcher.ObjectIndexFind(id);
            replacedert.IsNotNull(actual);
            replacedert.AreEqual(id, actual.Id);
            replacedert.AreEqual(s.ObjectType, actual.ObjectType);
            replacedert.AreEqual(s.ObjectId, actual.ObjectId);

            bool actual2 = searcher.ObjectIndexDelete(id);
            SearchObject existingAfterDelete = searcher.ObjectIndexFind(id);
            replacedert.IsNull(existingAfterDelete);
        }

19 View Source File : TextBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Size()
        {
            replacedert.IsTrue(textBoxElement1.Size.Width > 0);
            replacedert.IsTrue(textBoxElement1.Size.Height > 0);
            replacedert.IsTrue(textBoxElement2.Size.Width >= textBoxElement1.Size.Width);
            replacedert.IsTrue(textBoxElement2.Size.Height >= textBoxElement1.Size.Height);
        }

19 View Source File : ProductInventoryTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void ProductInventory_TestFindAll()
        {
            var proxy = CreateApiProxy();

            var findResponse = proxy.ProductInventoryFindAll();

            replacedert.IsTrue(findResponse.Content.Count > 0);

            CheckErrors(findResponse);
        }

19 View Source File : ToggleButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            var disableButtonCheckbox = session.FindElementByAccessibilityId("DisableToggle1");
            replacedert.IsTrue(toggleButtonElement.LocationOnScreenOnceScrolledIntoView.X >= disableButtonCheckbox.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(toggleButtonElement.LocationOnScreenOnceScrolledIntoView.Y >= disableButtonCheckbox.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : CompilationDatabaseTests.cs
License : Apache License 2.0
Project Creator : CoatiSoftware

[TestCategory("UnitTest"), TestMethod]
		public void TestCompilationDatabaseRetainsEscapedQuotesWhenDeserializedAfterSerialization()
		{
			CompileCommand command = new CompileCommand();
			command.File = "test.cpp";
			command.Directory = "./";
			command.Command = "D DEFINE=\"value\" test.cpp";

			CompilationDatabase originalCompilationDatabase = new CompilationDatabase();
			originalCompilationDatabase.AddCompileCommand(command);
			string serialized = originalCompilationDatabase.SerializeToJson();

			CompilationDatabase deserializedCompilationDatabase = new CompilationDatabase();
			deserializedCompilationDatabase.DeserializeFromJson(serialized);

			replacedert.IsTrue(deserializedCompilationDatabase == originalCompilationDatabase);
		}

19 View Source File : ToggleSwitch.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void LocationInView()
        {
            var header = session.FindElementByAccessibilityId("Header");

            replacedert.IsTrue(toggleSwitchElement.LocationOnScreenOnceScrolledIntoView.X >= header.LocationOnScreenOnceScrolledIntoView.X);
            replacedert.IsTrue(toggleSwitchElement.LocationOnScreenOnceScrolledIntoView.Y >= header.LocationOnScreenOnceScrolledIntoView.Y);
        }

19 View Source File : ProductInventoryTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void ProductInventory_TestFindAllAndForProduct()
        {
            //Create API Proxy.
            var proxy = CreateApiProxy();

            //Find all inventory
            var findAllResponse = proxy.ProductInventoryFindAll();
            CheckErrors(findAllResponse);
            replacedert.IsTrue(findAllResponse.Content.Count > 0);

            if (findAllResponse.Content.Count > 0)
                // Get Inventory for specific product if we have some data in database
            {
                var findForProductResponse = proxy.ProductInventoryFindForProduct(findAllResponse.Content[0].ProductBvin);

                replacedert.IsTrue(findForProductResponse.Content.Count > 0);

                var allInventoryOfProduct =
                    findAllResponse.Content.Where(p => p.ProductBvin == findAllResponse.Content[0].ProductBvin).ToList();

                var productInventory =
                    findForProductResponse.Content
                        .FirstOrDefault(p => p.Bvin == findAllResponse.Content[0].Bvin);

                replacedert.AreEqual(productInventory.Bvin, findAllResponse.Content[0].Bvin);

                replacedert.AreEqual(productInventory.ProductBvin, findAllResponse.Content[0].ProductBvin);

                replacedert.AreEqual(allInventoryOfProduct.Count, findForProductResponse.Content.Count);

                CheckErrors(findForProductResponse);
            }
        }

19 View Source File : ElementElements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindNestedElements_ByClreplacedName()
        {
            // Different Alarm & Clock application version uses different UI elements
            if (AlarmTabClreplacedName == "ListViewItem")
            {
                var elements = session.FindElementByAccessibilityId("TopNavMenuItemsHost").FindElementsByClreplacedName("ListViewItem");
                replacedert.IsNotNull(elements);
                replacedert.AreEqual(4, elements.Count);
                replacedert.IsTrue(elements.Contains(alarmTabElement));
            }
            else
            {
                var elements = session.FindElementByAccessibilityId("HomePagePivot").FindElementsByClreplacedName("Pivoreplacedem");
                replacedert.IsNotNull(elements);
                replacedert.AreEqual(4, elements.Count);
                replacedert.IsTrue(elements.Contains(alarmTabElement));
            }
        }

19 View Source File : LexiconTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanAddAWord()
        {
            string input = "thi";
			string culture = "en-US";

			Lexicon lex = new Lexicon(new StaticLexicon());

			long id = lex.AddOrCreateWord(input, culture);

            replacedert.IsTrue(id > 0);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElements_ByClreplacedName()
        {
            // There are 4 tabs element that can be Lisreplacedem or Pivoreplacedem depending on the
            // application version. This test excpects to see at least 4 of these elements
            var elements = session.FindElementsByClreplacedName(AlarmTabClreplacedName);
            replacedert.IsNotNull(elements);
            replacedert.IsTrue(elements.Count >= 4);
            replacedert.IsTrue(elements.Contains(alarmTabElement));
        }

19 View Source File : ProductsTests.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void Product_TestCountOfAll()
        {
            //Create API Proxy
            var proxy = CreateApiProxy();

            //Get count of all products.
            var countResponse = proxy.ProductsCountOfAll();
            CheckErrors(countResponse);
            replacedert.IsTrue(countResponse.Content > 0);
        }

19 View Source File : ElementSize.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetElementSize()
        {
            WindowsElement clearButton = session.FindElementByAccessibilityId("clearButton");
            replacedert.IsNotNull(clearButton);
            replacedert.IsTrue(clearButton.Size.Width > 0);
            replacedert.IsTrue(clearButton.Size.Height > 0);

            WindowsElement memButton = session.FindElementByAccessibilityId("memButton");
            replacedert.IsNotNull(memButton);
            replacedert.IsTrue(memButton.Size.Width > 0);
            replacedert.IsTrue(memButton.Size.Height > 0);

            // Clear button is always bigger than Mem button
            replacedert.IsTrue(clearButton.Size.Width > memButton.Size.Width);
            replacedert.IsTrue(clearButton.Size.Height > memButton.Size.Height);

            WindowsElement applicationWindow = session.FindElementByClreplacedName("ApplicationFrameWindow");
            replacedert.IsNotNull(applicationWindow);
            replacedert.AreEqual(session.Manage().Window.Size.Width, applicationWindow.Size.Width);
            replacedert.AreEqual(session.Manage().Window.Size.Height, applicationWindow.Size.Height);

            // Application top level window is always bigger than its button
            replacedert.IsTrue(applicationWindow.Size.Width > clearButton.Size.Width);
            replacedert.IsTrue(applicationWindow.Size.Height > clearButton.Size.Height);
        }

19 View Source File : CompilationDatabaseTests.cs
License : Apache License 2.0
Project Creator : CoatiSoftware

[TestCategory("UnitTest"), TestMethod]
		public void TestComparingCompileCommandWithSelfByValueWorks()
		{
			CompileCommand command1 = new CompileCommand();
			command1.File = "test.cpp";
			command1.Directory = "./";
			command1.Command = "D test test.cpp";

			CompileCommand command2 = new CompileCommand();
			command2.File = "test.cpp";
			command2.Directory = "./";
			command2.Command = "D test test.cpp";

			replacedert.IsTrue(command1 == command2);
		}

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_ModifierAlt()
        {
            session.Keyboard.SendKeys(Keys.Alt + "ED" + Keys.Alt); // Insert Time/Date
            replacedert.IsTrue(editBox.Text.Length > 0);
        }

19 View Source File : TouchScenarios.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod, TestCategory("SingleTouch")]
        public void Slide()
        {
            var touchable = AppSession.FindElementByAccessibilityId("Touchable");
            var startCoords = touchable.Coordinates.LocationInViewport;
            var endX = startCoords.X + TouchDistance.Long;
            var endY = startCoords.Y + TouchDistance.Long;

            TouchScreen.Down(startCoords.X, startCoords.Y);
            TouchScreen.Up(endX, endY);

            var endCoords = touchable.Coordinates.LocationInViewport;
            replacedert.IsTrue(endCoords.X > startCoords.X);
            replacedert.IsTrue(endCoords.Y > startCoords.Y);
        }

19 View Source File : LexiconTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void CanFindTwoWords()
        {
            string input = "thi";
            string input2 = "test";
			string culture = "en-US";

			Lexicon lex = new Lexicon(new StaticLexicon());
			long expected = lex.AddOrCreateWord(input, culture);
            replacedert.IsTrue(expected > 0);
			long expected2 = lex.AddOrCreateWord(input2, culture);
            replacedert.IsTrue(expected2 > 0);

			long actual2 = lex.FindWordId(input2, culture);
            replacedert.AreEqual(expected2, actual2);

			long actual = lex.FindWordId(input, culture);
            replacedert.AreEqual(expected, actual);
        }

19 View Source File : CreateCdbTests.cs
License : Apache License 2.0
Project Creator : CoatiSoftware

private void TestCompilationDatabaseForSolution(string solutionPath, bool nonSystemIncludesUseAngleBrackets = true)
		{
			replacedert.IsTrue(File.Exists(solutionPath), "solution path does not exist");

			Console.WriteLine("opening solution: " + solutionPath);
			Helpers.TestUtility.OpenSolution(solutionPath);

			Console.WriteLine("creating compilation database");

			CompilationDatabase output = null;
			try
			{
				output = CreateCompilationDatabaseForCurrentSolution(nonSystemIncludesUseAngleBrackets);
			}
			catch (Exception e)
			{
				Console.WriteLine("Exception: " + e.Message);
				Console.WriteLine("Stack Trace: " + e.StackTrace);
				replacedert.Fail("Caught an exception while creating compilation database.");
			}

			replacedert.IsNotNull(output);

			string cdbPath = Path.ChangeExtension(solutionPath, "json");
			if (!nonSystemIncludesUseAngleBrackets)
			{
				cdbPath = Path.GetDirectoryName(cdbPath) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(cdbPath) + "_non-system_includes.json";
			}

			if (_updateExpectedOutput)
			{
				output.SortAlphabetically();
				Console.WriteLine("writing compilation database to file: " + cdbPath);
				File.WriteAllText(cdbPath, output.SerializeToJson());
				replacedert.IsTrue(File.Exists(cdbPath));
			}
			else
			{
				Console.WriteLine("reading compilation database from file: " + cdbPath);
				CompilationDatabase expectedOutput = CompilationDatabase.LoadFromFile(cdbPath);
				replacedert.IsNotNull(expectedOutput);

				Console.WriteLine("comparing generated compilation database to expected output");
				replacedert.IsTrue(output == expectedOutput, "The created compilation database differs from the expected output");
			}

			Console.WriteLine("closing solution");
			Helpers.TestUtility.CloseCurrentSolution();
		}

19 View Source File : CompilationDatabaseTests.cs
License : Apache License 2.0
Project Creator : CoatiSoftware

[TestCategory("UnitTest"), TestMethod]
		public void TestComparingCompilationDatabaseWithSelfByValueWorks()
		{
			CompileCommand command = new CompileCommand();
			command.File = "test.cpp";
			command.Directory = "./";
			command.Command = "D test test.cpp";

			CompilationDatabase cdb1 = new CompilationDatabase();
			cdb1.AddCompileCommand(command);

			CompilationDatabase cdb2 = new CompilationDatabase();
			cdb2.AddCompileCommand(command);

			replacedert.IsTrue(cdb1 == cdb2);
		}

19 View Source File : SearcherTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void DoesntAddObjectsToIndexTwice()
        {
			SearchObject s = new SearchObject();
            s.ObjectType = 0;
            s.ObjectId = "1234";

			Lexicon lexicon = new Lexicon(new StaticLexicon());
			Searcher searcher = new Searcher(lexicon, new StaticSearcher());

            long id = searcher.ObjectIndexAddOrUpdate(s);

            replacedert.IsTrue(id > 0);

            long secondId = searcher.ObjectIndexAddOrUpdate(s);

            replacedert.AreEqual(id, secondId);
        }

19 View Source File : WorkflowTest.cs
License : MIT License
Project Creator : HotcakesCommerce

[TestMethod]
        public void Workflow_CreateRecurringSubscriptions()
        {
            var app = CreateHccAppInMemory();

            // Configure Authorize ARB
            var gateId = new Hotcakes.Payment.RecurringGateways.AuthorizeNet().Id;
            app.CurrentStore.Settings.PaymentReccuringGateway = gateId;
            app.CurrentStore.Settings.PaymentSettingsSet(gateId, new AuthorizeNetSettings
            {
                MerchantLoginId = "77pmw32Vh7LS",
                TransactionKey = "73629XQgg28GW2tp",
                DeveloperMode = true,
                DebugMode = true,
                TestMode = true
            });
            app.UpdateCurrentStore();

            // Create sample subscription
            var prod1 = new Product
            {
                Sku = "001",
                ProductName = "Subscription1",
                SitePrice = 10m,
                IsRecurring = true,
                RecurringInterval = 10,
                RecurringIntervalType = RecurringIntervalType.Days
            };
            app.CatalogServices.Products.Create(prod1);

            // Add subscription to cart
            var o = new Order {StoreId = app.CurrentStore.Id, OrderNumber = DateTime.Now.ToString("yyMMddHHmmss")};
            o.Items.Add(prod1.ConvertToLineItem(app));
            app.CalculateOrderAndSave(o);

            // Add card info
            var payManager = new OrderPaymentManager(o, app);
            payManager.RecurringSubscriptionAddCardInfo(new CardData
            {
                CardHolderName = "Test Card",
                CardNumber = "4111111111111111",
                ExpirationMonth = 1,
                ExpirationYear = 2020
            });

            o.BillingAddress.FirstName = "John";
            o.BillingAddress.LastName = "Joe";
            o.UserEmail = "[email protected]";

            // Run workflow task
            var c = new OrderTaskContext(app.CurrentRequestContext);
            c.UserId = app.CurrentCustomerId;
            c.Order = o;
            c.Inputs.SetProperty("hcc", "CardSecurityCode", "999");

            var task = new CreateRecurringSubscriptions();
            var taskResult = task.Execute(c);

            // Check result ---------------------
            replacedert.IsTrue(taskResult);
            var trans = app.OrderServices.Transactions.FindAllPaged(1, 100);
            replacedert.AreEqual(2, trans.Count);
            var tInfo = trans.FirstOrDefault(t => t.Action == ActionType.RecurringSubscriptionInfo);
            var tCreateSub = trans.FirstOrDefault(t => t.Action == ActionType.RecurringSubscriptionCreate);

            replacedert.IsNotNull(tInfo);
            replacedert.AreEqual("4111111111111111", tInfo.CreditCard.CardNumber);
            replacedert.AreEqual(2020, tInfo.CreditCard.ExpirationYear);
            replacedert.IsNotNull(tCreateSub);
            replacedert.AreEqual(10m, tCreateSub.Amount);
            replacedert.AreNotEqual("", tCreateSub.RefNum1);
            replacedert.AreEqual(tInfo.Idreplacedtring, tCreateSub.LinkedToTransaction);

            var subGatewey = new SubscriptionGateway2("77pmw32Vh7LS", "73629XQgg28GW2tp", ServiceMode.Test);

            var resSub = subGatewey.GetSubscriptionById(Convert.ToInt32(tCreateSub.RefNum1));

            replacedert.IsNotNull(resSub);
            replacedert.AreEqual("John", resSub.firstName);
            replacedert.AreEqual("Joe", resSub.lastName);
            replacedert.AreEqual(10, resSub.amount);
            replacedert.AreEqual(ARBSubscriptionStatusEnum.active, resSub.status);
            replacedert.IsTrue(resSub.invoice.Contains(tCreateSub.OrderNumber));
        }

19 View Source File : Slider.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Click()
        {
            sliderElement1.Click();
            replacedert.IsTrue(int.Parse(sliderElement1.Text) > 45); // The value of the slider when the center is clicked should be greater than 45 and close to 50

            sliderElement2.Click();
            replacedert.AreEqual("750", sliderElement2.Text);  // The value of the slider when the center is clicked
        }

See More Examples