Exemplo n.º 1
0
        public void AssertStartsWithGit(string uri)
        {
            StringFormatter stringFormatter = new StringFormatter();

            StringAssert.StartsWith("git://", stringFormatter.WebString(uri));
        }
Exemplo n.º 2
0
 public void ThrowsWhenDuplicateDiagnosticScope_Ancestor()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     InvalidOperationException ex = Assert.ThrowsAsync<InvalidOperationException>(async () => await client.DuplicateScopeAncestorAsync());
     StringAssert.Contains($"A scope has already started for event '{typeof(InvalidDiagnosticScopeTestClient).Name}.{nameof(client.DuplicateScopeAncestor)}'", ex.Message);
 }
Exemplo n.º 3
0
 public void ItFindsSteamFolder()
 {
     Assert.IsNotNull(RocksmithLocator.SteamFolder(), "No key found");
     StringAssert.Matches(RocksmithLocator.SteamFolder(), new Regex("steam", RegexOptions.IgnoreCase));
 }
Exemplo n.º 4
0
        public void AddABankAccount()
        {
            _webDriver.Navigate().GoToUrl("https://go.xero.com/Banking/Account/#find");
            var wait = new WebDriverWait(_webDriver, new TimeSpan(0, 0, 30));

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.CssSelector("input[data-ref='inputEl']")));
            _webDriver.FindElement(By.CssSelector("input[data-ref='inputEl']")).SendKeys("ANZ (NZ)");

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.ClassName("ba-allbanks-filter-prompt")));
            _webDriver.FindElement(By.ClassName("ba-allbanks-filter-prompt")).Click();

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("#ba-banklist-1023 ul li")));
            var         bankAccountElements  = _webDriver.FindElements(By.CssSelector("#ba-banklist-1023 ul li"));
            var         accountNames         = new List <string>();
            IWebElement targetAccountElement = null;

            foreach (IWebElement bankAccount in bankAccountElements)
            {
                string accountName = bankAccount.GetProperty("innerText");
                accountNames.Add(accountName);
                if (bankAccount.GetProperty("innerText") == "ANZ (NZ)")
                {
                    targetAccountElement = bankAccount;
                }
            }
            Assert.Contains("ANZ (NZ)", accountNames);
            targetAccountElement.Click();

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.TitleContains("account details"));
            _webDriver.FindElement(By.CssSelector("input[id^='accountname']")).SendKeys("Test Account Name");

            _webDriver.FindElement(By.CssSelector("input[id^='accounttype']")).Click();

            var bankAccountTypesElements = _webDriver.FindElements(By.CssSelector("li.ba-combo-list-item"));

            foreach (IWebElement bankAccountTypeElement in bankAccountTypesElements)
            {
                if (bankAccountTypeElement.GetProperty("innerText") == "Loan")
                {
                    //bankAccountTypeElement.Click(); this is a JS dropdown, this doesn't work
                    Actions builder = new Actions(_webDriver);
                    builder.MoveToElement(bankAccountTypeElement).Perform();
                    builder.Click(bankAccountTypeElement).Perform();
                }
            }

            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.CssSelector("input[id^='accountnumber-1068']")));
            _webDriver.FindElement(By.CssSelector("input[id^='accountnumber-1068']")).SendKeys("123");

            Actions continueButtonClicker = new Actions(_webDriver);
            var     continueButton        = _webDriver.FindElement(By.CssSelector("a[data-automationid='continueButton']"));

            continueButtonClicker.MoveToElement(continueButton).Perform();
            continueButtonClicker.Click(continueButton).Perform();

            //wait for redirect
            wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.CssSelector("header#gettingStarted")));

            string successMessage = _webDriver.FindElement(By.CssSelector(".message p")).Text;

            //Is the account name in the success message?
            StringAssert.Contains("Test", successMessage);

            var bankAccountNames        = new List <String>();
            var bankAccountNameElements = _webDriver.FindElements(By.CssSelector("div.bank-header a.bank-name"));

            foreach (IWebElement bankAccountNameElement in bankAccountNameElements)
            {
                string bankAccountName = bankAccountNameElement.GetProperty("innerText");
                bankAccountNames.Add(bankAccountName);
            }
            Assert.That(bankAccountNames, Has.Some.Contains("Test Account Name"));
        }
Exemplo n.º 5
0
        public void MergeAllJobs_IfQueueEmpty_ThrowsCOMException()
        {
            var ex = Assert.Throws <COMException>(() => _queue.MergeAllJobs());

            StringAssert.Contains("The queue must not be empty.", ex.Message);
        }
 public static void AssertRegistrationIncorectEmailAddres(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForIncorectElail.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForIncorectElail.Text);
 }
 public static void AssertRegistratioWithoutPassword(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForCharactersPassword.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForCharactersPassword.Text);
 }
Exemplo n.º 8
0
        public void CommitCmdShouldTrimAuthor(string input, string expected)
        {
            var actual = _gitModule.CommitCmd(false, author: input);

            StringAssert.AreEqualIgnoringCase(expected, actual);
        }
Exemplo n.º 9
0
        public void CommitCmdTests(bool amend, bool signOff, string author, bool useExplicitCommitMessage, bool noVerify, bool gpgSign, string gpgKeyId, string expected)
        {
            var actual = _gitModule.CommitCmd(amend, signOff, author, useExplicitCommitMessage, noVerify, gpgSign, gpgKeyId);

            StringAssert.AreEqualIgnoringCase(expected, actual);
        }
Exemplo n.º 10
0
        public void Extends()
        {
            string             json;
            JsonSchemaResolver resolver = new JsonSchemaResolver();

            json = @"{
  ""id"":""first"",
  ""type"":""object"",
  ""additionalProperties"":{}
}";

            JsonSchema first = JsonSchema.Parse(json, resolver);

            json =
                @"{
  ""id"":""second"",
  ""type"":""object"",
  ""extends"":{""$ref"":""first""},
  ""additionalProperties"":{""type"":""string""}
}";

            JsonSchema second = JsonSchema.Parse(json, resolver);

            Assert.AreEqual(first, second.Extends[0]);

            json =
                @"{
  ""id"":""third"",
  ""type"":""object"",
  ""extends"":{""$ref"":""second""},
  ""additionalProperties"":false
}";

            JsonSchema third = JsonSchema.Parse(json, resolver);

            Assert.AreEqual(second, third.Extends[0]);
            Assert.AreEqual(first, third.Extends[0].Extends[0]);

            StringWriter   writer     = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);

            jsonWriter.Formatting = Formatting.Indented;

            third.WriteTo(jsonWriter, resolver);

            string writtenJson = writer.ToString();

            StringAssert.AreEqual(@"{
  ""id"": ""third"",
  ""type"": ""object"",
  ""additionalProperties"": false,
  ""extends"": {
    ""$ref"": ""second""
  }
}", writtenJson);

            StringWriter   writer1     = new StringWriter();
            JsonTextWriter jsonWriter1 = new JsonTextWriter(writer1);

            jsonWriter1.Formatting = Formatting.Indented;

            third.WriteTo(jsonWriter1);

            writtenJson = writer1.ToString();
            StringAssert.AreEqual(@"{
  ""id"": ""third"",
  ""type"": ""object"",
  ""additionalProperties"": false,
  ""extends"": {
    ""id"": ""second"",
    ""type"": ""object"",
    ""additionalProperties"": {
      ""type"": ""string""
    },
    ""extends"": {
      ""id"": ""first"",
      ""type"": ""object"",
      ""additionalProperties"": {}
    }
  }
}", writtenJson);
        }
Exemplo n.º 11
0
        public void MergeArray()
        {
            var left = (JObject)JToken.FromObject(new
            {
                Array1 = new object[]
                {
                    new
                    {
                        Property1 = new
                        {
                            Property1 = 1,
                            Property2 = 2,
                            Property3 = 3,
                            Property4 = 4,
                            Property5 = (object)null
                        }
                    },
                    new { },
                    3,
                    null,
                    5,
                    null
                }
            });
            var right = (JObject)JToken.FromObject(new
            {
                Array1 = new object[]
                {
                    new
                    {
                        Property1 = new
                        {
                            Property1 = (object)null,
                            Property2 = 3,
                            Property3 = new
                            {
                            },
                            Property5 = (object)null
                        }
                    },
                    null,
                    null,
                    4,
                    5.1,
                    null,
                    new
                    {
                        Property1 = 1
                    }
                }
            });

            left.Merge(right, new JsonMergeSettings
            {
                MergeArrayHandling = MergeArrayHandling.Merge
            });

            string json = left.ToString();

            StringAssert.AreEqual(@"{
  ""Array1"": [
    {
      ""Property1"": {
        ""Property1"": 1,
        ""Property2"": 3,
        ""Property3"": {},
        ""Property4"": 4,
        ""Property5"": null
      }
    },
    {},
    3,
    4,
    5.1,
    null,
    {
      ""Property1"": 1
    }
  ]
}", json);
        }
Exemplo n.º 12
0
        public void Extends_Multiple()
        {
            string json = @"{
  ""type"":""object"",
  ""extends"":{""type"":""string""},
  ""additionalProperties"":{""type"":""string""}
}";

            JsonSchema s = JsonSchema.Parse(json);

            StringWriter   writer     = new StringWriter();
            JsonTextWriter jsonWriter = new JsonTextWriter(writer);

            jsonWriter.Formatting = Formatting.Indented;

            string newJson = s.ToString();

            StringAssert.AreEqual(@"{
  ""type"": ""object"",
  ""additionalProperties"": {
    ""type"": ""string""
  },
  ""extends"": {
    ""type"": ""string""
  }
}", newJson);


            json = @"{
  ""type"":""object"",
  ""extends"":[{""type"":""string""}],
  ""additionalProperties"":{""type"":""string""}
}";

            s = JsonSchema.Parse(json);

            writer                = new StringWriter();
            jsonWriter            = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            newJson = s.ToString();

            StringAssert.AreEqual(@"{
  ""type"": ""object"",
  ""additionalProperties"": {
    ""type"": ""string""
  },
  ""extends"": {
    ""type"": ""string""
  }
}", newJson);


            json = @"{
  ""type"":""object"",
  ""extends"":[{""type"":""string""},{""type"":""object""}],
  ""additionalProperties"":{""type"":""string""}
}";

            s = JsonSchema.Parse(json);

            writer                = new StringWriter();
            jsonWriter            = new JsonTextWriter(writer);
            jsonWriter.Formatting = Formatting.Indented;

            newJson = s.ToString();

            StringAssert.AreEqual(@"{
  ""type"": ""object"",
  ""additionalProperties"": {
    ""type"": ""string""
  },
  ""extends"": [
    {
      ""type"": ""string""
    },
    {
      ""type"": ""object""
    }
  ]
}", newJson);
        }
Exemplo n.º 13
0
        public void DsfWebPostActivity_Execute_WithInValidWebResponse_ShouldError()
        {
            //------------Setup for test--------------------------
            const string response = "{\"Location\": \"Paris\",\"Time\": \"May 29, 2013 - 09:00 AM EDT / 2013.05.29 1300 UTC\"," +
                                    "\"Wind\": \"from the NW (320 degrees) at 10 MPH (9 KT) (direction variable):0\"," +
                                    "\"Visibility\": \"greater than 7 mile(s):0\"," +
                                    "\"Temperature\": \"59 F (15 C)\"," +
                                    "\"DewPoint\": \"41 F (5 C)\"," +
                                    "\"RelativeHumidity\": \"51%\"," +
                                    "\"Pressure\": \"29.65 in. Hg (1004 hPa)\"," +
                                    "\"Status\": \"Success\"" +
                                    "}";
            const string invalidResponse = "{\"Location\" \"Paris\",\"Time\": \"May 29, 2013 - 09:00 AM EDT / 2013.05.29 1300 UTC\"," +
                                           "\"Wind\": \"from the NW (320 degrees) at 10 MPH (9 KT) (direction variable):0\"," +
                                           "\"Visibility\": \"greater than 7 mile(s):0\"," +
                                           "\"Temperature\": \"59 F (15 C)\"," +
                                           "\"DewPoint\": \"41 F (5 C)\"," +
                                           "\"RelativeHumidity\": \"51%\"," +
                                           "\"Pressure\": \"29.65 in. Hg (1004 hPa)\"," +
                                           "\"Status\": \"Success\"" +
                                           "";
            var environment = new ExecutionEnvironment();

            environment.Assign("[[City]]", "PMB", 0);
            environment.Assign("[[CountryName]]", "South Africa", 0);
            var dsfWebPostActivity = new TestDsfWebPostActivity();

            dsfWebPostActivity.ResourceCatalog = new Mock <IResourceCatalog>().Object;
            var serviceInputs = new List <IServiceInput> {
                new ServiceInput("CityName", "[[City]]"), new ServiceInput("Country", "[[CountryName]]")
            };
            var serviceOutputs = new List <IServiceOutputMapping> {
                new ServiceOutputMapping("Location", "[[weather().Location]]", "weather"), new ServiceOutputMapping("Time", "[[weather().Time]]", "weather"), new ServiceOutputMapping("Wind", "[[weather().Wind]]", "weather"), new ServiceOutputMapping("Visibility", "[[Visibility]]", "")
            };

            dsfWebPostActivity.Inputs  = serviceInputs;
            dsfWebPostActivity.Outputs = serviceOutputs;
            var serviceXml = XmlResource.Fetch("WebService");
            var service    = new WebService(serviceXml)
            {
                RequestResponse = response
            };

            dsfWebPostActivity.OutputDescription = service.GetOutputDescription();
            dsfWebPostActivity.ResponseFromWeb   = invalidResponse;
            var dataObjectMock = new Mock <IDSFDataObject>();

            dataObjectMock.Setup(o => o.Environment).Returns(environment);
            dataObjectMock.Setup(o => o.EsbChannel).Returns(new Mock <IEsbChannel>().Object);
            dsfWebPostActivity.ResourceID = InArgument <Guid> .FromValue(Guid.Empty);

            dsfWebPostActivity.QueryString = "";
            dsfWebPostActivity.PostData    = "";
            dsfWebPostActivity.SourceId    = Guid.Empty;
            dsfWebPostActivity.Headers     = new List <INameValue>();
            //------------Execute Test---------------------------
            dsfWebPostActivity.Execute(dataObjectMock.Object, 0);
            //------------Assert Results-------------------------
            Assert.IsNotNull(dsfWebPostActivity.OutputDescription);
            Assert.AreEqual(1, environment.Errors.Count);
            StringAssert.Contains(environment.Errors.ToList()[0], "Invalid character after parsing property name");
        }
Exemplo n.º 14
0
        public void StartsithHttp(string uri)
        {
            StringFormatter stringFormatter = new StringFormatter();

            StringAssert.StartsWith("http://", stringFormatter.WebString(uri));
        }
Exemplo n.º 15
0
 public static void AssertRegistrationIncorectPhone(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForPhone.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForPhone.Text);
 }
        public void SerializeMultiTableDataSet()
        {
            DataSet ds = new DataSet();

            ds.Tables.Add(CreateDataTable("FirstTable", 2));
            ds.Tables.Add(CreateDataTable("SecondTable", 1));

            string json = JsonConvert.SerializeObject(ds, Formatting.Indented, new IsoDateTimeConverter());
            // {
            //   "FirstTable": [
            //     {
            //       "StringCol": "Item Name",
            //       "Int32Col": 1,
            //       "BooleanCol": true,
            //       "TimeSpanCol": "10.22:10:15.1000000",
            //       "DateTimeCol": "2000-12-29T00:00:00Z",
            //       "DecimalCol": 64.0021
            //     },
            //     {
            //       "StringCol": "Item Name",
            //       "Int32Col": 2,
            //       "BooleanCol": true,
            //       "TimeSpanCol": "10.22:10:15.1000000",
            //       "DateTimeCol": "2000-12-29T00:00:00Z",
            //       "DecimalCol": 64.0021
            //     }
            //   ],
            //   "SecondTable": [
            //     {
            //       "StringCol": "Item Name",
            //       "Int32Col": 1,
            //       "BooleanCol": true,
            //       "TimeSpanCol": "10.22:10:15.1000000",
            //       "DateTimeCol": "2000-12-29T00:00:00Z",
            //       "DecimalCol": 64.0021
            //     }
            //   ]
            // }

            DataSet deserializedDs = JsonConvert.DeserializeObject <DataSet>(json, new IsoDateTimeConverter());

            StringAssert.AreEqual(@"{
  ""FirstTable"": [
    {
      ""StringCol"": ""Item Name"",
      ""Int32Col"": 1,
      ""BooleanCol"": true,
      ""TimeSpanCol"": ""10.22:10:15.1000000"",
      ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
      ""DecimalCol"": 64.0021
    },
    {
      ""StringCol"": ""Item Name"",
      ""Int32Col"": 2,
      ""BooleanCol"": true,
      ""TimeSpanCol"": ""10.22:10:15.1000000"",
      ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
      ""DecimalCol"": 64.0021
    }
  ],
  ""SecondTable"": [
    {
      ""StringCol"": ""Item Name"",
      ""Int32Col"": 1,
      ""BooleanCol"": true,
      ""TimeSpanCol"": ""10.22:10:15.1000000"",
      ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
      ""DecimalCol"": 64.0021
    }
  ]
}", json);

            Assert.IsNotNull(deserializedDs);
        }
Exemplo n.º 17
0
 public static void AssertRegistrationPageUserName(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesUserName.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesUserName.Text);
 }
        public void SerializeDataSetProperty()
        {
            DataSet ds = new DataSet();

            ds.Tables.Add(CreateDataTable("FirstTable", 2));
            ds.Tables.Add(CreateDataTable("SecondTable", 1));

            DataSetAndTableTestClass c = new DataSetAndTableTestClass
            {
                Before = "Before",
                Set    = ds,
                Middle = "Middle",
                Table  = CreateDataTable("LoneTable", 2),
                After  = "After"
            };

            string json = JsonConvert.SerializeObject(c, Formatting.Indented, new IsoDateTimeConverter());

            StringAssert.AreEqual(@"{
  ""Before"": ""Before"",
  ""Set"": {
    ""FirstTable"": [
      {
        ""StringCol"": ""Item Name"",
        ""Int32Col"": 1,
        ""BooleanCol"": true,
        ""TimeSpanCol"": ""10.22:10:15.1000000"",
        ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
        ""DecimalCol"": 64.0021
      },
      {
        ""StringCol"": ""Item Name"",
        ""Int32Col"": 2,
        ""BooleanCol"": true,
        ""TimeSpanCol"": ""10.22:10:15.1000000"",
        ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
        ""DecimalCol"": 64.0021
      }
    ],
    ""SecondTable"": [
      {
        ""StringCol"": ""Item Name"",
        ""Int32Col"": 1,
        ""BooleanCol"": true,
        ""TimeSpanCol"": ""10.22:10:15.1000000"",
        ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
        ""DecimalCol"": 64.0021
      }
    ]
  },
  ""Middle"": ""Middle"",
  ""Table"": [
    {
      ""StringCol"": ""Item Name"",
      ""Int32Col"": 1,
      ""BooleanCol"": true,
      ""TimeSpanCol"": ""10.22:10:15.1000000"",
      ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
      ""DecimalCol"": 64.0021
    },
    {
      ""StringCol"": ""Item Name"",
      ""Int32Col"": 2,
      ""BooleanCol"": true,
      ""TimeSpanCol"": ""10.22:10:15.1000000"",
      ""DateTimeCol"": ""2000-12-29T00:00:00Z"",
      ""DecimalCol"": 64.0021
    }
  ],
  ""After"": ""After""
}", json);

            DataSetAndTableTestClass c2 = JsonConvert.DeserializeObject <DataSetAndTableTestClass>(json, new IsoDateTimeConverter());

            Assert.AreEqual(c.Before, c2.Before);
            Assert.AreEqual(c.Set.Tables.Count, c2.Set.Tables.Count);
            Assert.AreEqual(c.Middle, c2.Middle);
            Assert.AreEqual(c.Table.Rows.Count, c2.Table.Rows.Count);
            Assert.AreEqual(c.After, c2.After);
        }
Exemplo n.º 19
0
 public static void AssertRegistrationWrongFile(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForInvalidFormatFile.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForInvalidFormatFile.Text);
 }
Exemplo n.º 20
0
        public void Lang_InvalidKey_Throws()
        {
            var ex = Assert.Catch <Exception>(() => Lang("#@$(*&"));

            StringAssert.Contains("No Lang", ex.Message);
        }
Exemplo n.º 21
0
 public static void AssertRegistratioPasswordDoNotMatch(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForCharactersDoNotMatch.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForCharactersDoNotMatch.Text);
 }
Exemplo n.º 22
0
 public void VerifyFileWasOpened()
 {
     StringAssert.EndsWith("OpenMe.txt", MainScreen.FileName);
 }
Exemplo n.º 23
0
        public async Task FromLoginCredentialsTest()
        {
            string xml = @"<?xml version=""1.0"" encoding=""utf-8""?>
<response>
      <control>
            <status>success</status>
            <senderid>testsenderid</senderid>
            <controlid>sessionProvider</controlid>
            <uniqueid>false</uniqueid>
            <dtdversion>3.0</dtdversion>
      </control>
      <operation>
            <authentication>
                  <status>success</status>
                  <userid>testuser</userid>
                  <companyid>testcompany</companyid>
                  <sessiontimestamp>2015-12-06T15:57:08-08:00</sessiontimestamp>
            </authentication>
            <result>
                  <status>success</status>
                  <function>getSession</function>
                  <controlid>testControlId</controlid>
                  <data>
                        <api>
                              <sessionid>fAkESesSiOnId..</sessionid>
                              <endpoint>https://unittest.intacct.com/ia/xml/xmlgw.phtml</endpoint>
                        </api>
                  </data>
            </result>
      </operation>
</response>";

            HttpResponseMessage mockResponse1 = new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = new StringContent(xml)
            };

            List <HttpResponseMessage> mockResponses = new List <HttpResponseMessage>
            {
                mockResponse1,
            };

            MockHandler mockHandler = new MockHandler(mockResponses);

            SdkConfig config = new SdkConfig()
            {
                CompanyId    = "testcompany",
                UserId       = "testuser",
                UserPassword = "******",
                MockHandler  = mockHandler,
            };

            LoginCredentials loginCreds = new LoginCredentials(config, senderCreds);

            SessionCredentials sessionCreds = await provider.FromLoginCredentials(loginCreds);

            Assert.AreEqual("fAkESesSiOnId..", sessionCreds.SessionId);
            StringAssert.Equals("https://unittest.intacct.com/ia/xml/xmlgw.phtml", sessionCreds.Endpoint);
            Assert.IsInstanceOfType(sessionCreds.SenderCreds, typeof(SenderCredentials));
        }
Exemplo n.º 24
0
 public static void AssertRegistrationPageWithoutFirstNames(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForFirstNames.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForFirstNames.Text);
     //Assert.AreEqual("This field is required", page.FirstName.Text);
 }
Exemplo n.º 25
0
 public void ThrowsWhenNoDiagnosticScope()
 {
     InvalidDiagnosticScopeTestClient client = InstrumentClient(new InvalidDiagnosticScopeTestClient());
     InvalidOperationException ex = Assert.ThrowsAsync<InvalidOperationException>(async () => await client.NoScopeAsync());
     StringAssert.Contains("Expected some diagnostic scopes to be created, found none", ex.Message);
 }
Exemplo n.º 26
0
 public static void AssertRegistrationPageWithoutLastNames(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForLastNames.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForLastNames.Text);
 }
        public void DoubleClick_IsRenderedInError_OnOverlappedWithOverlayFailure_IfCustomizedToWaitForNoOverlayByJs()
        {
            Configuration.Timeout         = 0.25;
            Configuration.PollDuringWaits = 0.1;
            Given.OpenedPageWithBody(
                @"
                <div 
                    id='overlay' 
                    style='
                        display: block;
                        position: fixed;
                        display: block;
                        width: 100%;
                        height: 100%;
                        top: 0;
                        left: 0;
                        right: 0;
                        bottom: 0;
                        background-color: rgba(0,0,0,0.1);
                        z-index: 2;
                        cursor: pointer;
                    '
                >
                </div>

                <span 
                  id='link' 
                  ondblclick='window.location=this.href + ""#second""' 
                >to h2</span>
                <h2 id='second'>Heading 2</h2>
                "
                );
            var beforeCall = DateTime.Now;

            try
            {
                S("span").With(waitForNoOverlapFoundByJs: true).DoubleClick();

                Assert.Fail("should fail with exception");
            }

            catch (TimeoutException error)
            {
                var afterCall = DateTime.Now;
                Assert.Greater(afterCall, beforeCall.AddSeconds(0.25));
                Assert.Less(afterCall, beforeCall.AddSeconds(1.25));

                StringAssert.DoesNotContain("second", Configuration.Driver.Url);

                var lines = error.Message.Split("\n").Select(
                    item => item.Trim()
                    ).ToList();

                Assert.Contains("Timed out after 0.25s, while waiting for:", lines);
                Assert.Contains(
                    "Browser.Element(span).Actions.DoubleClick(self.ActualNotOverlappedWebElement).Perform()",
                    lines
                    );
                Assert.Contains("Reason:", lines);
                Assert.Contains(
                    "Element: <span "
                    + "id=\"link\" "
                    + "ondblclick=\"window.location=this.href + &quot;#second&quot;\""
                    + ">to h2</span>"
                    ,
                    lines
                    );
                Assert.NotNull(lines.Find(item => item.Contains(
                                              "is overlapped by: <div id=\"overlay\" "
                                              )));
            }
        }
Exemplo n.º 28
0
 public static void AssertRegistrationPagePhone(this RegistrationPage page, string text)
 {
     Assert.IsTrue(page.ErrorMessagesForPhone.Displayed);
     StringAssert.Contains(text, page.ErrorMessagesForPhone.Text);
     //Assert.AreEqual("Minimum 10 Digits starting with Country Code", page.Phone.Text);
 }
Exemplo n.º 29
0
 public void ItFindsRocksmith2014FolderFromUbisoftKey()
 {
     StringAssert.Matches(RocksmithLocator.Rocksmith2014FolderFromUbisoftKey(), new Regex("Rocksmith2014"));
 }
Exemplo n.º 30
0
        public void Empty()
        {
            StringFormatter stringFormatter = new StringFormatter();

            StringAssert.AreEqualIgnoringCase(stringFormatter.WebString(""), "");
        }