Esempio n. 1
0
 public static WatiN.Core.Element FirstMatching(this ElementCollection elementCollection, params Constraint[] constraints)
 {
     return((from constraint in constraints
             let element = elementCollection.First(constraint)
                           where element != null
                           select element).FirstOrDefault());
 }
Esempio n. 2
0
        public void TestLinq()
        {
            driver.Navigate().GoToUrl("http://www.google.com");
            var elements = new ElementCollection(driver.FindElements(By.XPath("//*")));

            elements.First(x => x.GetAttribute("name") == "q" && x.Displayed).Click();
        }
Esempio n. 3
0
        public void TestElementAPI()
        {
            driver.Navigate().GoToUrl("http://www.google.com");
            var elements = new ElementCollection(driver.FindElements(By.Name("q")));

            elements.First().Click();
        }
Esempio n. 4
0
        public void Constructor_ExpectedValues()
        {
            // Call
            var plotView = new CategoryPlotView();

            // Assert
            Assert.IsInstanceOf <PlotView>(plotView);
            Assert.AreEqual(DockStyle.Fill, plotView.Dock);

            Assert.IsNull(plotView.ModelTitle);
            Assert.IsNull(plotView.VerticalAxisTitle);

            PlotModel plotModel = plotView.Model;

            ElementCollection <Axis> axes = plotModel.Axes;

            Assert.AreEqual(2, axes.Count);

            Axis categoryAxis = axes.First(ax => ax.GetType() == typeof(CategoryAxis));

            Assert.AreEqual(1, categoryAxis.MinorStep);
            Assert.AreEqual(90, categoryAxis.Angle);

            Assert.AreEqual(-0.5, categoryAxis.AbsoluteMinimum);
            Assert.IsFalse(categoryAxis.IsPanEnabled);
            Assert.IsFalse(categoryAxis.IsZoomEnabled);

            Axis linearAxis = axes.First(ax => ax.GetType() == typeof(LinearAxis));

            Assert.AreEqual(0, linearAxis.MinimumPadding);
            Assert.IsFalse(linearAxis.IsPanEnabled);
            Assert.IsFalse(linearAxis.IsZoomEnabled);
            Assert.IsNull(linearAxis.Title);

            Assert.AreEqual(0, plotModel.LegendBorderThickness);
            Assert.AreEqual(LegendOrientation.Horizontal, plotModel.LegendOrientation);
            Assert.AreEqual(LegendPlacement.Outside, plotModel.LegendPlacement);
            Assert.AreEqual(LegendPosition.TopCenter, plotModel.LegendPosition);
        }
Esempio n. 5
0
        public void VerticalAxisTitle_AlwaysSetsNewVerticalAxisTitleToModelAndInvalidatesView(string newTitle)
        {
            // Setup
            using (var form = new Form())
                using (var view = new CategoryPlotView())
                {
                    form.Controls.Add(view);
                    var invalidated = 0;
                    view.Invalidated += (sender, args) => invalidated++;

                    form.Show();

                    // Call
                    view.VerticalAxisTitle = newTitle;

                    // Assert
                    PlotModel plotModel = view.Model;

                    ElementCollection <Axis> axes = plotModel.Axes;
                    var categoryAxis = (LinearAxis)axes.First(ax => ax.GetType() == typeof(LinearAxis));
                    Assert.AreEqual(newTitle, categoryAxis.Title);
                    Assert.AreEqual(1, invalidated);
                }
        }
Esempio n. 6
0
 public void TestLinq()
 {
     driver.Navigate().GoToUrl("http://www.google.com");
     var elements = new ElementCollection(driver.FindElements(By.XPath("//*")));
     elements.First(x => x.GetAttribute("name") == "q" && x.Displayed).Click();
 }
Esempio n. 7
0
 public void TestElementAPI()
 {
     driver.Navigate().GoToUrl("http://www.google.com");
     var elements = new ElementCollection(driver.FindElements(By.Name("q")));
     elements.First().Click();
 }