public void StringChecks()
        {
            var valueToTest = "Abc Def Xyz Bin";

            // Constraint-style asserts:
            Assert.That("", Is.Empty);
            Assert.That(valueToTest, Is.Not.Empty);
            Assert.That(valueToTest, Does.Contain("Def"));
            Assert.That(valueToTest, Does.Not.Contain("Bang"));
            Assert.That(valueToTest, Does.StartWith("Abc"));
            Assert.That(valueToTest, Does.Not.StartWith("Def"));
            Assert.That(valueToTest, Does.EndWith("Bin"));
            Assert.That(valueToTest, Does.Not.EndWith("Xyz"));
            Assert.That(valueToTest, Is.EqualTo("abc def xyz bin").IgnoreCase);
            Assert.That(valueToTest, Is.Not.EqualTo("something else").IgnoreCase);
            Assert.That(valueToTest, Does.Match("^Abc.*Bin$"));
            Assert.That(valueToTest, Does.Not.Match("^Abc.*Def$"));


            // Classic-style asserts:
            StringAssert.Contains("Def", valueToTest);
            StringAssert.DoesNotContain("Bang", valueToTest);
            StringAssert.StartsWith("Abc", valueToTest);
            StringAssert.DoesNotStartWith("Def", valueToTest);
            StringAssert.EndsWith("Bin", valueToTest);
            StringAssert.DoesNotEndWith("Xyz", valueToTest);
            StringAssert.AreEqualIgnoringCase("abc def xyz bin", valueToTest);
            StringAssert.AreNotEqualIgnoringCase("something else", valueToTest);
            StringAssert.IsMatch("^Abc.*Bin$", valueToTest);      //first param is a regex pattern
            StringAssert.DoesNotMatch("^Abc.*Def$", valueToTest); //first param is a regex pattern
        }
示例#2
0
        //Method to check for Name and DOB details for Pupil.
        public bool GetPupilBasicDetailsNameDOB()
        {
            var displayNamePopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforNamePopUp)));
            var pupilNamePopup   = displayNamePopup[0].Text;

            var displayDOBPopup = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId(cssforDOBPopUp)));
            var pupilDOBPopup   = displayDOBPopup[0].Text;

            var elements = WebContext.WebDriver.FindElements(By.CssSelector(SeleniumHelper.AutomationId("PreferredListName_Learner")));

            String Name  = elements[0].Text;
            String fName = Name.ToString().Substring((Name.IndexOf(",") + 2));
            String lName = Name.ToString().Substring(0, Name.IndexOf(","));

            String pupilName = fName + lName;

            StringAssert.AreNotEqualIgnoringCase(pupilName, pupilNamePopup, "Failed");

            TestResultReporter.Log("<b>Pupil Name - </b> " + pupilNamePopup);

            int index = pupilDOBPopup.IndexOf(':');

            TestResultReporter.Log("<b> DOB -  </b>" + pupilDOBPopup.ToString().Substring(index + 1));
            return((pupilNamePopup != null) && (pupilDOBPopup != null)); // All are mandatory fields
        }
示例#3
0
        public void VerifySearchResults(BasePage currentPage)
        {
            currentPage.WaitAndType(By.XPath(ControlPanelIDs.SearchBox), "home");
            currentPage.Click(By.XPath(ControlPanelIDs.SearchButton));

            var searchPage = new SearchPage(_driver);

            searchPage.WaitForElement(By.XPath("//div[@class = 'dnnSearchResultContainer']"), 60);

            Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT Page Title for '" + searchPage.PageHeaderLabel + "' page:");
            StringAssert.Contains(searchPage.PageHeaderLabel.ToUpper(),
                                  searchPage.WaitForElement(By.XPath(ControlPanelIDs.PageHeaderID)).Text.ToUpper(),
                                  "The wrong page is opened or The title of " + searchPage.PageHeaderLabel + " page is changed");

            Assert.That(searchPage.FindElements(By.XPath(SearchPage.ResultsList)).Count, Is.AtLeast(1),
                        "At least one item is displayed");

            StringAssert.AreNotEqualIgnoringCase(searchPage.FindElement(By.XPath(SearchPage.TitleOfFirstFoundElement)).Text,
                                                 "No Results Found",
                                                 "'No Results Found' record is displayed");

            //Trace.WriteLine(BasePage.TraceLevelPage + "Total result number '" + searchPage.FindElement(By.XPath(SearchPage.ResultNumber)).Text);
            //StringAssert.AreEqualIgnoringCase(searchPage.FindElement(By.XPath(SearchPage.ResultNumber)).Text, "About 23 Results",
            //		"Result number is not correct");
        }
示例#4
0
        public void SortByServiceSupplier()
        {
            var Columns = driver.FindElement(By.Id("btnColumns"));

            Columns.Click();
            new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("/html/body/div[27]/div/i/img")));

            var addColumn = driver.FindElement(By.XPath(".//*[@id='li_ServiceSupplier']/input[4]"));

            addColumn.Click();
            var SaveBtn = driver.FindElement(By.XPath(".//*[@id='gaugeColumns']/div/div/div[3]/button[1]"));

            SaveBtn.Click();
            new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("/html/body/div[27]/div/i/img")));


            var    sortByServiceSupplier = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[1]/th[9]/a"));
            String valBefore             = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[10]/td[1]")).Text;

            sortByServiceSupplier.Click();
            new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("/html/body/div[27]/div/i/img")));

            String RealText = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[10]/td[1]")).Text;

            StringAssert.AreNotEqualIgnoringCase(valBefore, RealText);
        }
示例#5
0
        public void DoesNotReturnFizzBuzz_WhenDivisible_By_ThreeOnly()
        {
            // given the way the solution is, let us only execute up until the point of where we expect the end result to be
            // grab the last result and compare with the actual execution for each of the points for FizzBuzz.

            FizzBuzzRequest fifteenUpperBound = new FizzBuzzRequest {
                UpperBound = 6, UseDefaultRules = true
            };
            FizzBuzzRequest thirtyUpperBound = new FizzBuzzRequest {
                UpperBound = 2, UseDefaultRules = true
            };
            FizzBuzzRequest fortyFiveUpperBound = new FizzBuzzRequest {
                UpperBound = 7, UseDefaultRules = true
            };

            var runner           = new FizzBuzzRunner();
            var expectedFizzBuzz = "FizzBuzz";

            var actualRunnerFifteenResult = runner.FizzBuzzRun(fifteenUpperBound).ToList();
            var actualFizzBuzzResult      = actualRunnerFifteenResult.Last();

            StringAssert.AreNotEqualIgnoringCase(expectedFizzBuzz, actualFizzBuzzResult.Result);

            var actualRunnerThirtyResult   = runner.FizzBuzzRun(thirtyUpperBound).ToList();
            var actualFizzBuzzThirtyResult = actualRunnerThirtyResult.Last();

            StringAssert.AreNotEqualIgnoringCase(expectedFizzBuzz, actualFizzBuzzThirtyResult.Result);

            var actualRunnerFortyFiveResult   = runner.FizzBuzzRun(fortyFiveUpperBound).ToList();
            var actualFizzBuzzFortyFiveResult = actualRunnerFortyFiveResult.Last();

            StringAssert.AreNotEqualIgnoringCase(expectedFizzBuzz, actualFizzBuzzFortyFiveResult.Result);
        }
示例#6
0
        public void Test_method_name()
        {
// Arrange
            Database db     = HostApplicationServices.WorkingDatabase;
            Document doc    = Application.DocumentManager.GetDocument(db);
            DBText   dbText = new DBText {
                TextString = "cat"
            };
            string testMe;

// Act
            using (doc.LockDocument())
            {
                using (db.TransactionManager.StartTransaction())
                {
                    ObjectId dbTextObjectId = DbEntity.AddToModelSpace(dbText, db);
                    dbText.TextString = "dog";

                    DBText testText = dbTextObjectId.Open(OpenMode.ForRead, false) as DBText;
                    testMe = testText != null ? testText.TextString : string.Empty;
                }
            }
// Assert
            StringAssert.AreEqualIgnoringCase("dog", testMe, "DBText string was not changed to \"dog\".");
            StringAssert.AreNotEqualIgnoringCase("cat", testMe, "DBText string was not changed.");
        }
示例#7
0
        public void ValidateGenerateNewEmail()
        {
            var email = _tenMinuteMail.EmailAddress;

            _tenMinuteMail.GenerateNewEmailAddress();
            StringAssert.AreNotEqualIgnoringCase(email, _tenMinuteMail.EmailAddress, "Email shouldn't match");
        }
示例#8
0
        public void StringChecks()
        {
            var valueToTest = "Foo Bar Baz Bin";

            // Constraint-style asserts:
            Assert.That("", Is.Empty);
            Assert.That(valueToTest, Is.Not.Empty);
            Assert.That(valueToTest, Does.Contain("Bar"));
            Assert.That(valueToTest, Does.Not.Contain("Bang"));
            Assert.That(valueToTest, Does.StartWith("Foo"));
            Assert.That(valueToTest, Does.Not.StartWith("Bar"));
            Assert.That(valueToTest, Does.EndWith("Bin"));
            Assert.That(valueToTest, Does.Not.EndWith("Baz"));
            Assert.That(valueToTest, Is.EqualTo("foo bar baz bin").IgnoreCase);
            Assert.That(valueToTest, Is.Not.EqualTo("something else").IgnoreCase);
            Assert.That(valueToTest, Does.Match("^Foo.*Bin$"));     // param is a regex pattern
            Assert.That(valueToTest, Does.Not.Match("^Foo.*Bar$")); // param is a regex pattern


            // Classic-style asserts:
            StringAssert.Contains("Bar", valueToTest);
            StringAssert.DoesNotContain("Bang", valueToTest);
            StringAssert.StartsWith("Foo", valueToTest);
            StringAssert.DoesNotStartWith("Bar", valueToTest);
            StringAssert.EndsWith("Bin", valueToTest);
            StringAssert.DoesNotEndWith("Baz", valueToTest);
            StringAssert.AreEqualIgnoringCase("foo bar baz bin", valueToTest);
            StringAssert.AreNotEqualIgnoringCase("something else", valueToTest);
            StringAssert.IsMatch("^Foo.*Bin$", valueToTest);      //first param is a regex pattern
            StringAssert.DoesNotMatch("^Foo.*Bar$", valueToTest); //first param is a regex pattern
        }
示例#9
0
        public void Interpret_OnlyEarthyProduct_DecimalWithZeroFraction_ValidResponseWithCredit()
        {
            this.SetInterpreter(GetIntergalacticProductsCache(), GetEarthyProductsCache());
            this.validator.Setup(i => i.IsProductRepresentationValid(It.IsAny <IEnumerable <string> >(), It.IsAny <string>(),
                                                                     It.IsAny <InputType>(), It.IsAny <int>(), It.IsAny <IDictionary <string, string> >()))
            .Returns(true)
            .Verifiable();

            this.productCategorizer.Setup(i => i.GetProductType(It.IsAny <string>()))
            .Returns(ProductType.Earthy)
            .Verifiable();

            var content = new Tuple <int, IEnumerable <string>, string>(
                1, new Collection <string> {
                "Gold"
            }, CREDITS_TEXT);                                        // Gold has product value: 100M

            var result = this.interpreter.Interpret(content);

            Assert.IsNotEmpty(result);
            StringAssert.AreNotEqualIgnoringCase(INVALID_RESPONSE, result);
            StringAssert.Contains(CREDITS_TEXT, result);
            StringAssert.DoesNotContain(".", result);

            this.validator.Verify(i => i.IsProductRepresentationValid(It.IsAny <IEnumerable <string> >(), It.IsAny <string>(),
                                                                      It.IsAny <InputType>(), It.IsAny <int>(), It.IsAny <IDictionary <string, string> >()), Times.Once);

            this.productCategorizer.Verify(i => i.GetProductType(It.IsAny <string>()), Times.AtLeastOnce);

            this.productHelper.Verify(i => i.GetMultiplierInArabicNumeralForm(It.IsAny <IEnumerable <string> >(), It.IsAny <IDictionary <string, string> >()), Times.Never);
        }
示例#10
0
        public void Old_Test_That_Used_to_Crash_2016_and_not_2013_but_I_fixed_it()
        {
            // Arrange
            Database db  = HostApplicationServices.WorkingDatabase;
            Document doc = Application.DocumentManager.GetDocument(db);

            string testMe;

            // Act
            using (doc.LockDocument())
            {
                using (var tx = db.TransactionManager.StartTransaction())
                {
                    using (DBText dbText = new DBText {
                        TextString = "cat"
                    })
                    {
                        ObjectId dbTextObjectId = DbEntity.AddToModelSpace(dbText, db);
                        dbText.TextString = "dog";

                        var testText = dbTextObjectId.Open(OpenMode.ForRead, false) as DBText;
                        testMe = testText != null
                                     ? testText.TextString
                                     : string.Empty;
                    }
                    tx.Commit();
                }
            }
            // Assert
            StringAssert.AreEqualIgnoringCase("dog", testMe, "DBText string was not changed to \"dog\".");
            StringAssert.AreNotEqualIgnoringCase("cat", testMe, "DBText string was not changed.");
        }
示例#11
0
        private void VerifySearchResults(BasePage currentPage)
        {
            currentPage.WaitAndType(By.XPath(BasePage.SearchBox), "awesome");
            currentPage.Click(By.XPath(BasePage.SearchButton));

            SearchPage searchPage = new SearchPage(_driver);

            searchPage.WaitForElement(By.XPath("//div[@class = 'dnnSearchResultContainer']"), 60);

            Trace.WriteLine(BasePage.TraceLevelPage + "ASSERT Page Title for '" + SearchPage.PageTitleLabel + "' page:");
            StringAssert.Contains(SearchPage.PageTitleLabel,
                                  searchPage.WaitForElement(By.XPath("//span[contains(@id, '" + BasePage.PageTitle + "')]")).
                                  Text,
                                  "The wrong page is opened or The title of " + SearchPage.PageTitleLabel + " page is changed");

            Assert.That(searchPage.FindElements(By.XPath(SearchPage.ResultsList)).Count, Is.AtLeast(1),
                        "At least one item is displayed");

            StringAssert.AreNotEqualIgnoringCase(searchPage.FindElement(By.XPath(SearchPage.TitleOfFirstFoundElement)).Text,
                                                 "No Results Found",
                                                 "'No Results Found' record is displayed");

            //StringAssert.AreEqualIgnoringCase(searchPage.FindElement(By.XPath(SearchPage.ResultNumber)).Text, "About 23 Results",
            //	                                "Result number is not correct");
        }
        public void UnwrapExceptionMessage_Returns_WebException_Response()
        {
            WebException webException = null;

            //purposely cause a WebException to get a populated Response property
            try
            {
                new WebClient().DownloadString("http://www.example.com/this/will/fail");
            }
            catch (WebException ex)
            {
                webException = ex;
            }
            //validate that the exception has the properties we are interested in
            Assert.NotNull(webException);
            Assert.NotNull(webException.Response);
            Assert.False(String.IsNullOrEmpty(webException.Message));

            string message = webException.UnwrapExceptionMessage();

            //we should have gotten a message by unwrapping
            Assert.False(String.IsNullOrEmpty(message));
            //but it should not be the same as the exception's message property -> it came from the Response
            StringAssert.AreNotEqualIgnoringCase(webException.Message, message);
        }
        public void TestObject()
        {
            Quaternion2D q1 = new Quaternion2D(2, 4);
            Quaternion2D q2 = new Quaternion2D(3, 5);

            Assert.AreEqual(q1.GetHashCode(), (new Quaternion2D(2, 4)).GetHashCode());
            Assert.AreNotEqual(q1.GetHashCode(), q2.GetHashCode());

            object o = new object();

            Assert.AreNotEqual(q1, o);
            o = q1;
            Assert.AreEqual(q1, o);
            o = q2;
            Assert.AreNotEqual(q1, o);

            StringAssert.AreEqualIgnoringCase(q1.ToString(), "(2, 4)");
            StringAssert.AreNotEqualIgnoringCase(q1.ToString(), q2.ToString());

            Quaternion2D q = new Quaternion2D();

            q.angle = Mathf.PI * 0.3f;
            Rotation2D rot = new Rotation2D(Mathf.PI * 0.3f);

            Assert.AreEqual(q * Vector2.right, rot.x);
        }
示例#14
0
        public void SortByNextServiceDate()
        {
            var Columns = driver.FindElement(By.Id("btnColumns"));

            Columns.Click(); Thread.Sleep(500);
            var addColumn = driver.FindElement(By.XPath(".//*[@id='li_NextServicenDate']/input[4]"));

            addColumn.Click();
            Thread.Sleep(500);
            var SaveBtn = driver.FindElement(By.XPath(".//*[@id='gaugeColumns']/div/div/div[3]/button[1]"));

            SaveBtn.Click();
            Thread.Sleep(15000);

            var    sortByNextServiceDate = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[1]/th[9]/a"));
            String valBefore             = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[10]/td[1]")).Text;

            sortByNextServiceDate.Click();
            Thread.Sleep(30000);
            sortByNextServiceDate.Click();
            Thread.Sleep(30000);
            String RealText = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[10]/td[1]")).Text;

            StringAssert.AreNotEqualIgnoringCase(valBefore, RealText);
        }
        public void Encrypt_modifies_the_original_content()
        {
            var bytes          = Encoding.UTF8.GetBytes(_originalContent);
            var encryptedBytes = _byteArrayEncryptionService.Encrypt(bytes);
            var result         = Encoding.UTF8.GetString(encryptedBytes);

            StringAssert.AreNotEqualIgnoringCase(result, _originalContent);
        }
示例#16
0
        public void EqualIgnoringCase_Test()
        {
            string actual   = "adc";
            string expected = "adc";

            StringAssert.AreEqualIgnoringCase(expected, actual);
            expected = "a";
            StringAssert.AreNotEqualIgnoringCase(expected, actual);
        }
示例#17
0
 void Test(int limit)
 {
     Assert.IsNotNull(lastTransactions);
     Assert.AreEqual(limit, lastTransactions.Count);
     StringAssert.AreNotEqualIgnoringCase("", lastTransactions[0].Id);
     Assert.Greater(lastTransactions[0].Timestamp, 0);
     Assert.Greater(lastTransactions[0].TransactionRate, 0);
     Assert.Greater(lastTransactions[0].Amount, 0);
     Assert.IsTrue(lastTransactions[0].TransactionType == "Buy" || lastTransactions[0].TransactionType == "Sell");
 }
示例#18
0
        public void ForCategoryPage_With_Complex_Category_Uri_Doesnt_Escape_Complex_Category()
        {
            string complexCategory = "Complex & Category";

            var uri = SodaUri.ForCategoryPage(StringMocks.Host, complexCategory);

            StringAssert.AreEqualIgnoringCase(String.Format("/categories/{0}", complexCategory), uri.LocalPath);

            StringAssert.AreNotEqualIgnoringCase(String.Format("/categories/{0}", Uri.EscapeDataString(complexCategory)), uri.LocalPath);
        }
示例#19
0
        public void SortByGaugeNominal()
        {
            var    sortByGaugeNominal = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[1]/th[3]/a"));
            String valBefore          = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[2]/td[1]")).Text;

            sortByGaugeNominal.Click();
            new WebDriverWait(driver, TimeSpan.FromSeconds(60)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.InvisibilityOfElementLocated(By.XPath("/html/body/div[27]/div/i/img")));
            String RealText = driver.FindElement(By.XPath(".//*[@id='gauges']/table/tbody/tr[3]/td[1]")).Text;

            StringAssert.AreNotEqualIgnoringCase(valBefore, RealText);
        }
示例#20
0
        public void OpenExcelWithWrongSheetName()
        {
            List <string> lstSheetNames = new List <string>();

            lstSheetNames.Add("设备类型2");
            lstSheetNames.Add("回路名称3");
            System.Data.DataSet ds = _excelService.OpenExcel(_testExcelFilePath, lstSheetNames);
            Assert.AreEqual(lstSheetNames.Count, ds.Tables.Count);
            StringAssert.AreNotEqualIgnoringCase(lstSheetNames[0].ToString(), ds.Tables[0].TableName.ToString());
            StringAssert.AreNotEqualIgnoringCase(lstSheetNames[1].ToString(), ds.Tables[1].TableName.ToString());
        }
示例#21
0
        public void ReadMethodWhenUriIsValid()
        {
            var    uri = new Uri("http://www.voila.fr");
            string response;

            response = nget.ReadMethod(uri);

            Assert.IsNotNull(uri);
            StringAssert.AreNotEqualIgnoringCase(response, "Reader fail");
            Assert.IsTrue(response.Length > 0);
        }
示例#22
0
        public void MakeSureItSanitized(string htmlFragment, string message)
        {
            var target           = new DefaultHtmlSanitizer();
            var elementWhiteList = CreateElementWhiteList();

            var actual = target.GetSafeHtmlFragment(htmlFragment, elementWhiteList);

            if (htmlFragment != "See Below")
            {
                StringAssert.AreNotEqualIgnoringCase(htmlFragment, actual, message);
            }
        }
 public void GetCurrentPositionModeTest()
 {
     try
     {
         bool result = trade.GetCurrentPositionMode();
         Assert.IsTrue(true);
     }
     catch (ErrorMessageException e)
     {
         StringAssert.AreNotEqualIgnoringCase("", e.Message);   // Invalide api key (test api key on public api, not testnet).
     }
 }
 public void ChangePostionModeTest()
 {
     try
     {
         bool result = trade.ChangePositionMode(true);
         Assert.IsTrue(result);
     }
     catch (ErrorMessageException e)
     {
         StringAssert.AreNotEqualIgnoringCase("", e.Message);   // Invalide api key (test api key on public api, not testnet).
         StringAssert.AreEqualIgnoringCase("API-key format invalid.", e.Message);
     }
 }
        public void GetAccountTransactionHistoryListTest()
        {
            GBinanceFuturesClient.Trade trade = new BinanceFuturesClient(Config.PublicKey, Config.PrivateKey).Trade;

            try
            {
                trade.GetAccountTransactionHistory("USDT", 1588362716945);
            }
            catch (ErrorMessageException e)
            {
                StringAssert.AreNotEqualIgnoringCase("", e.Message);   // Invalide api key (test api key on public api, not testnet, unavailable in testnet).
                StringAssert.AreEqualIgnoringCase("Invalid Api-Key ID.", e.Message);
            }
        }
        public void NewFundsTransferTest()
        {
            GBinanceFuturesClient.Trade trade = new BinanceFuturesClient(Config.PublicKey, Config.PrivateKey).Trade;

            try
            {
                trade.NewFundsTransfer("USDT", 10, 1);
            }
            catch (ErrorMessageException e)
            {
                StringAssert.AreNotEqualIgnoringCase("", e.Message);   // Invalide api key (test api key on public api, not testnet).
                StringAssert.AreEqualIgnoringCase("Invalid Api-Key ID.", e.Message);
            }
        }
示例#27
0
        public void testStrings()
        {
            string actual = "ABCDEFG";

            StringAssert.Contains("BCD", actual);
            StringAssert.DoesNotContain("DCB", actual);
            StringAssert.StartsWith("ABC", actual);
            StringAssert.DoesNotStartWith("BCD", actual);
            StringAssert.EndsWith("FG", actual);
            StringAssert.DoesNotEndWith("BCD", actual);
            StringAssert.AreEqualIgnoringCase("abcdefg", actual);
            StringAssert.AreNotEqualIgnoringCase("aaaaaaa", actual);
            StringAssert.IsMatch("A.+", actual);
            StringAssert.DoesNotMatch("K", actual);
        }
        public void Encrypt_scrambles_the_input_stream()
        {
            var content = "This is some content I want encrypting";

            using (var inputStream = new MemoryStream(Encoding.UTF8.GetBytes(content)))
            {
                var result = _fileEncryptionService.Encrypt(inputStream);

                using (var reader = new StreamReader(result))
                {
                    var encryptedContent = reader.ReadToEnd();
                    StringAssert.AreNotEqualIgnoringCase(encryptedContent, content);
                }
            }
        }
示例#29
0
        public void Should_FindElements_WithDefaultName_ViaElementFactory()
        {
            var buttons = Factory.FindButtons(By.XPath("//*"));

            Assert.Multiple(() =>
            {
                Assert.IsTrue(buttons.Count > 1);
                for (var i = 0; i < buttons.Count; i++)
                {
                    var button    = buttons[i];
                    var endOfName = (i + 1).ToString();
                    StringAssert.AreNotEqualIgnoringCase(endOfName, button.Name);
                    StringAssert.EndsWith(endOfName, button.Name);
                }
            });
        }
示例#30
0
        public void EditComment_TryToEditComment_returnTrue()
        {
            //Arrange
            var comment = CreateFakeComment();

            comment = database.AddNewComment(comment);
            var initialCommentText = comment.Text;

            //Act
            comment.Text = CreateRandomString();
            database.EditComment(comment);

            var updatedComment = database.GetCommentById(comment.CommentId);

            //Assert
            StringAssert.AreNotEqualIgnoringCase(initialCommentText, updatedComment.Text);
        }