Exemplo n.º 1
0
        public void TestRadical(string latex, string degree, string radicand) =>
        TestOuter(latex, 1, 18.56, 4, degree.IsEmpty() ? 20 : 21.44, d => {
            var radical = Assert.IsType <RadicalDisplay <TFont, TGlyph> >(d);
            Assert.Equal(new Range(0, 1), radical.Range);
            Assert.False(radical.HasScript);
            Assert.Equal(new PointF(), radical.Position);
            Assert.NotNull(radical.Radicand);

            if (degree.IsNonEmpty())
            {
                TestList(1, 9.8, 2.8, 7, 5.56, 8.736, LinePosition.Regular, Range.UndefinedInt, dd => {
                    var line3 = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(dd);
                    Assert.Single(line3.Atoms);
                    AssertText(degree, line3);
                    Assert.Equal(new PointF(), line3.Position);
                    Assert.Equal(new Range(0, 1), line3.Range);
                    Assert.False(line3.HasScript);
                })(radical.Degree);
            }
            else
            {
                Assert.Null(radical.Degree);
            }

            TestList(1, 14, 4, 10, degree.IsEmpty() ? 10 : 11.44, 0, LinePosition.Regular, Range.UndefinedInt, dd => {
                var line2 = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(dd);
                Assert.Single(line2.Atoms);
                AssertText(radicand, line2);
                Assert.Equal(new PointF(), line2.Position);
                Assert.Equal(new Range(0, 1), line2.Range);
                Assert.False(line2.HasScript);
            })(radical.Radicand);
        });
Exemplo n.º 2
0
        [Theory, InlineData('[', ']'), InlineData('(', '}'), InlineData('{', ']')] // Using ) confuses the test explorer...
        public void TestInner(char left, char right) =>
        TestOuter($@"a\left{left}x\right{right}", 2, 14, 4, 43.333,
                  d => Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d),
                  d => {
            var inner = Assert.IsType <InnerDisplay <TFont, TGlyph> >(d);
            Approximately.At(13.333, 0, inner.Position);
            Assert.Equal(new Range(1, 1), inner.Range);
            Assert.Equal(14, inner.Ascent);
            Assert.Equal(4, inner.Descent);
            Assert.Equal(30, inner.Width);

            var glyph = Assert.IsType <GlyphDisplay <TFont, TGlyph> >(inner.Left);
            Approximately.At(13.333, 0, glyph.Position);
            Assert.Equal(Range.NotFound, glyph.Range);
            Assert.False(glyph.HasScript);
            Assert.Equal(left, glyph.Glyph);

            TestList(1, 14, 4, 10, 23.333, 0, LinePosition.Regular, Range.UndefinedInt,
                     d => {
                var line = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
                Assert.Single(line.Atoms);
                AssertText("x", line);
                Assert.Equal(new PointF(), line.Position);
                Assert.Equal(new Range(0, 1), d.Range);
                Assert.False(line.HasScript);
            })(inner.Inner);

            var glyph2 = Assert.IsType <GlyphDisplay <TFont, TGlyph> >(inner.Right);
            Approximately.At(33.333, 0, glyph2.Position);
            Assert.Equal(Range.NotFound, glyph2.Range);
            Assert.False(glyph2.HasScript);
            Assert.Equal(right, glyph2.Glyph);
        });
Exemplo n.º 3
0
 public void TestIntegralLimits() =>
 TestOuter(@"\int\limits^\pi_0 \theta d\theta", 4, 30.6, 19.94, 43.333,
           d => {
     var largeOp = Assert.IsType <LargeOpLimitsDisplay <TFont, TGlyph> >(d);
     Assert.Equal(new Range(0, 1), largeOp.Range);
     var glyph = Assert.IsType <GlyphDisplay <TFont, TGlyph> >(largeOp.NucleusDisplay);
     Assert.Equal('∫', glyph.Glyph);
     Assert.Equal(new PointF(), glyph.Position);
     Assert.False(glyph.HasScript);
     TestList(1, 9.8, 2.8, 7, 1.5, 20.8, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var superscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("π", superscript);
         Assert.Single(superscript.Atoms);
         Assert.Equal(new PointF(), superscript.Position);
         Assert.False(superscript.HasScript);
         Assert.Equal(new Range(0, 1), superscript.Range);
     })(largeOp.UpperLimit);
     TestList(1, 9.8, 2.8, 7, 1.5, -17.14, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var subscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("0", subscript);
         Assert.Single(subscript.Atoms);
         Assert.Equal(new PointF(), subscript.Position);
         Assert.False(subscript.HasScript);
         Assert.Equal(new Range(0, 1), subscript.Range);
     })(largeOp.LowerLimit);
 },
           d => {
     var textAfter = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
     AssertText("θdθ", textAfter);
     Assert.Equal(new Range(1, 3), textAfter.Range);
 });
Exemplo n.º 4
0
        public void TestFraction(string latex, double lineThickness) =>
        TestOuter(latex, 1, 27.54, 17.72, 10,
                  d => {
            var fraction = Assert.IsType <FractionDisplay <TFont, TGlyph> >(d);
            Assert.Equal(new Range(0, 1), fraction.Range);
            Assert.Equal(new PointF(), fraction.Position);
            Assert.False(fraction.HasScript);
            Approximately.Equal(lineThickness, fraction.LineThickness);

            TestList(1, 14, 4, 10, 0, 13.54, LinePosition.Regular, Range.UndefinedInt,
                     dd => {
                var subNumerator = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(dd);
                Assert.Single(subNumerator.Atoms);
                AssertText("1", subNumerator);
                Assert.Equal(new PointF(), subNumerator.Position);
                Assert.Equal(new Range(0, 1), subNumerator.Range);
                Assert.False(subNumerator.HasScript);
            })(fraction.Numerator);

            TestList(1, 14, 4, 10, 0, -13.72, LinePosition.Regular, Range.UndefinedInt,
                     dd => {
                var subDenominator = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(dd);
                Assert.Single(subDenominator.Atoms);
                AssertText("3", subDenominator);
                Assert.Equal(new PointF(), subDenominator.Position);
                Assert.Equal(new Range(0, 1), subDenominator.Range);
                Assert.False(subDenominator.HasScript);
            })(fraction.Denominator);
        });
Exemplo n.º 5
0
 public void TestLimit() =>
 TestOuter(@"\infty = \lim_{x\to 0^+} \frac{1}{x}", 4, 27.54, 21.186, 84.444,
           d => {
     var textBefore = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
     AssertText("∞=", textBefore);
     Assert.Equal(new Range(0, 2), textBefore.Range);
 },
           d => {
     var largeOp = Assert.IsType <LargeOpLimitsDisplay <TFont, TGlyph> >(d);
     Assert.Equal(new Range(2, 1), largeOp.Range);
     var largeOpText = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(largeOp.NucleusDisplay);
     AssertText("lim", largeOpText);
     Approximately.Equal(new PointF(31.111f, 0), largeOpText.Position);
     Assert.False(largeOpText.HasScript);
     TestList(3, 11.046, 2.8, 26, 38.111, -18.386, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var subscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("x→0", subscript);
         Assert.Equal(3, subscript.Atoms.Count);
         Assert.Equal(new PointF(), subscript.Position);
         Assert.True(subscript.HasScript);
         Assert.Equal(new Range(0, 3), subscript.Range);
     },
              TestList(1, 7, 2, 5, 21, 4.046, LinePosition.Superscript, 2,
                       d => {
         var superscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("+", superscript);
         Assert.Single(superscript.Atoms);
         Assert.Equal(new PointF(), superscript.Position);
         Assert.False(superscript.HasScript);
         Assert.Equal(new Range(0, 1), superscript.Range);
     }))(largeOp.LowerLimit);
 },
           d => {
     var fraction = Assert.IsType <FractionDisplay <TFont, TGlyph> >(d);
     Assert.Equal(new Range(3, 1), fraction.Range);
     TestList(1, 14, 4, 10, 74.444, 13.54, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var superscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("1", superscript);
         Assert.Single(superscript.Atoms);
         Assert.Equal(new PointF(), superscript.Position);
         Assert.False(superscript.HasScript);
         Assert.Equal(new Range(0, 1), superscript.Range);
     })(fraction.Numerator);
     TestList(1, 14, 4, 10, 74.444, -13.72, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var subscript = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         AssertText("x", subscript);
         Assert.Single(subscript.Atoms);
         Assert.Equal(new PointF(), subscript.Position);
         Assert.False(subscript.HasScript);
         Assert.Equal(new Range(0, 1), subscript.Range);
     })(fraction.Denominator);
 });
Exemplo n.º 6
0
        public void test_collection_item_collection_and_property_change_notification()
        {
            TestList  objList           = new TestList();
            TestClass objTest           = new TestClass();
            bool      collectionChanged = false;
            bool      propertyChanged   = false;

            objList.CollectionChanged += (s, e) => collectionChanged = true;

            objList.Add(objTest);

            Assert.IsTrue(collectionChanged, "Collection change should have fired.");

            objList.ItemPropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "DirtyProp")
                {
                    propertyChanged = true;
                }
            };

            objTest.DirtyProp = "test value";

            Assert.IsTrue(propertyChanged, "Item property change should have fired.");
        }
Exemplo n.º 7
0
        void KeyboardKeyDown1(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
        {
            if (e.Key == OpenTK.Input.Key.Escape)
            {
                Quit(null, null);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F1)
            {
                TestList.Add("new string");
                NotifyValueChanged("TestList", TestList);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F4)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/testWindow.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F5)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/testWindow2.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F6)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/imlEditor.crow");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F2)
            {
                idx--;
            }
            else if (e.Key == OpenTK.Input.Key.F3)
            {
                idx++;
            }
            else
            {
                return;
            }

            CrowInterface.ClearInterface();

            if (idx == testFiles.Length)
            {
                idx = 0;
            }
            else if (idx < 0)
            {
                idx = testFiles.Length - 1;
            }

            this.Title = testFiles [idx] + ". Press <F3> to cycle examples.";
            GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]);

            obj.DataSource = this;
        }
Exemplo n.º 8
0
        public string DeleteTest(TestList ob)
        {
            db.TestLists.Remove(ob);
            db.SaveChanges();

            return("deleted successfully");
        }
Exemplo n.º 9
0
        //Gets tests and puts them in the editTestComboBox
        private void AdminForm_Load(object sender, EventArgs e)
        {
            currentTest = new Test();
            List <Test> testList          = new List <Test>();
            string      stringErrorString = "";

            if (TestList.getTests(testList, ref stringErrorString))
            {
                foreach (Test test in testList)
                {
                    editTestComboBox.Items.Add(test);
                }
            }
            else
            {
                MessageBox.Show(stringErrorString);
            }
            this.Activate();

            imageBoxLabels = new List <Control>();
            itemsDataGrid.Columns[1].ReadOnly = true;
            imageBoxLabels.Add(heightLabel);
            imageBoxLabels.Add(heightTextLabel);
            imageBoxLabels.Add(widthLabel);
            imageBoxLabels.Add(widthTextLabel);
            imageBoxLabels.Add(sizeLabel);
            imageBoxLabels.Add(sizeTextLabel);
            setImageBoxLabelVisibility(false);
            customTestButton.Enabled = false;
        }
Exemplo n.º 10
0
        //Get all registerd tests
        public ActionResult GetAllTest()
        {
            List <TestList> tsList = new List <TestList>();
            TestList        obj_ts_list;
            var             result = (from t in DB.Tests
                                      join td in DB.TestDetails on t.TestId equals td.TestId
                                      orderby td.Date descending
                                      select new
            {
                td.Date,
                td.NoOfParticipants,
                t.SportsName,
                td.TestDetailsId,
            }).ToList();

            foreach (var res in result)
            {
                string date = string.Format("{0:dd-MM-yyyy}", res.Date);
                obj_ts_list                  = new TestList();
                obj_ts_list.Date             = date;
                obj_ts_list.NoOfParticipants = res.NoOfParticipants;
                obj_ts_list.TestName         = res.SportsName;
                obj_ts_list.TestDeatilsId    = res.TestDetailsId;
                tsList.Add(obj_ts_list);
            }

            if (result.Count > 0)
            {
                return(Json(new { msgdetail = "success", resultCode = 1, data = tsList }));
            }
            else
            {
                return(Json(new { msgdetail = "success", resultCode = 0, data = "" }));
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Removes all child nodes in <code>TestList</code> - a container for parent tests only.
 /// When <code>Flush()</code> is called, it adds all parent tests to the report and child
 /// tests as nodes. This method makes sure no child tests are added as top-level nodes.
 /// </summary>
 private void RemoveChildTests()
 {
     lock (TestList)
     {
         TestList = TestList.Where(x => !x.GetTest().ChildNode).ToList();
     }
 }
Exemplo n.º 12
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string fileName = filePhoto.ShortFileName;
                if (fileName != "")
                {
                    fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");

                    if (filePhoto.HasFile)
                    {
                        filePhoto.SaveAs(Server.MapPath("~/Uploads/" + fileName));

                        List <TestList> objDetailData = Session["objMainEntityDetail"] as List <TestList>;
                        TestList        objDetailItem = new TestList();

                        objDetailItem.v_FileName = fileName;
                        objDetailItem.v_Path     = Server.MapPath("~/Uploads/" + fileName);
                        objDetailData.Add(objDetailItem);

                        Session["objMainEntityDetail"] = objDetailData;
                        BindGridDetail();
                    }
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
            }
        }
Exemplo n.º 13
0
        //List all Test details
        public IActionResult Index()
        {
            List <TestList> tsList = new List <TestList>();
            TestList        obj_ts_list;

            var result = (from t in DB.Tests
                          join td in DB.TestDetails on t.TestId equals td.TestId
                          orderby td.Date descending
                          select new
            {
                td.Date,
                td.NoOfParticipants,
                t.SportsName,
                td.TestDetailsId,
            }).ToList();

            foreach (var res in result)
            {
                string date = string.Format("{0:dd-MM-yyyy}", res.Date);
                obj_ts_list                  = new TestList();
                obj_ts_list.Date             = date;
                obj_ts_list.NoOfParticipants = res.NoOfParticipants;
                obj_ts_list.TestName         = res.SportsName;
                obj_ts_list.TestDeatilsId    = res.TestDetailsId;
                tsList.Add(obj_ts_list);
            }
            ViewBag.Tests       = DB.Tests.ToList();
            ViewBag.TestDeatils = tsList;
            return(View());
        }
Exemplo n.º 14
0
        public ActionResult MyTestHistory()
        {
            TestList tl = new TestList();
            DataSet  DS = tl.GetUserTestList(Convert.ToInt32(Session["uid"]), con);

            return(View(DS));
        }
Exemplo n.º 15
0
 public void AddTest(params Test[] test)
 {
     if (test != null)
     {
         TestList.AddRange(test);
     }
 }
Exemplo n.º 16
0
 public MachineEditViewModel(ModuleViewModel Parent)
 {
     this.Parent = Parent;
     TestList.Add(new Department(1, "1", "1", -1));
     TestList.Add(new Department(2, "2", "2", -1));
     SelectedItem = (Parent as MachineManagerViewModel).SelectedItem;
 }
Exemplo n.º 17
0
        public void AddTestFromMetadataShouldCreateTestWithMetadata()
        {
            var testList = new TestList(processContextMock.Object);
            var test     = testList.AddTest(metadata);

            Assert.That(test.Metadata == metadata);
        }
Exemplo n.º 18
0
 protected override sealed void OnInitialize()
 {
     Logger.Info("OnInitialize: Enter");
     TestList = new TestList(ProcessContext);
     DefaultInitialize();
     Logger.Info("OnInitialize: Exit");
 }
        public void Init(IPackageVersion packageVersion, ValidationSuiteReportData reportData)
        {
            if (packageVersion == null)
            {
                return;
            }
            if (packageVersion != PackageVersion)
            {
                OnSelected(null);
            }

            PackageVersion = packageVersion;

            Header.text         = $"{PackageVersion.displayName} Validation Report";
            ValidationType.text = $"Validation Type: {reportData.Type}";

            Report = reportData;
            TestList.Clear();
            Details.value = "";

            if (Report != null)
            {
                Header.tooltip = $"Test was run using the {reportData.Type} validation type.";
                if (Report.Tests != null)
                {
                    foreach (var test in Report.Tests)
                    {
                        TestList.Add(new ReportRow(test, SelectRow));
                    }
                }
            }
        }
Exemplo n.º 20
0
 protected override sealed void OnShutdown()
 {
     SafeLog(() => Logger.Info("OnShutdown: Enter"));
     TestList.Clear();
     DefaultShutdown();
     SafeLog(() => Logger.Info("OnShutdown: Exit"));
 }
Exemplo n.º 21
0
    /// <summary>
    /// 检测链表是否有环,有则返回环的开头,否则为null
    /// </summary>
    /// <param name="list"></param>
    /// <returns></returns>
    public static TestList DetectCycle(TestList list)
    {
        var  fast       = list;
        var  slow       = fast;
        bool isCircular = true;

        do
        {
            if (fast.Next == null || fast.Next.Next == null)
            {
                isCircular = false;
                break;
            }

            slow = slow.Next;
            fast = fast.Next.Next;
        } while (fast != slow);

        if (!isCircular)
        {
            return(null);
        }

        slow = list;
        while (slow != fast)
        {
            slow = slow.Next;
            fast = fast.Next;
        }

        return(slow);
    }
Exemplo n.º 22
0
        public void AddTestFromMetadataShouldAddTestToList()
        {
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(metadata);
            Assert.That(testList.Tests.Count() == 1);
        }
Exemplo n.º 23
0
        protected virtual void Terminate()
        {
            TestList.ForEach(x =>
            {
                if (!x.GetTest().HasEnded)
                {
                    var ex = new ExtentTestInterruptedException(InternalWarning);

                    x.GetTest().InternalWarning = InternalWarning;
                    x.Log(LogStatus.Fail, ex);

                    AddTest(x.GetTest());
                }
            });

            Flush();

            _reporterList.ForEach(x =>
            {
                x.Stop();
            });

            _reporterList.Clear();

            _terminated = true;
        }
Exemplo n.º 24
0
 //Deletes the current test
 private void deleteTestButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to delete the " + currentTest.TestName +
                         " test?", "Delete test?", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         string stringErrorString = "";
         if (ItemList.deleteItems(currentTest.TestID, ref stringErrorString))
         {
             if (TestList.deleteTest(currentTest.TestID, ref stringErrorString))
             {
                 MessageBox.Show("The " + currentTest.TestName + " test has been deleted");
                 editTestComboBox.Items.Remove(currentTest.TestName);
                 currentTest.TestID   = 0;
                 currentTest.TestName = "";
                 cancelButton.PerformClick();
             }
             else
             {
                 MessageBox.Show(stringErrorString);
             }
         }
         else
         {
             MessageBox.Show(stringErrorString);
         }
     }
 }
Exemplo n.º 25
0
 public void TestColor() =>
 TestOuter(@"\color{red}\color{blue}x\colorbox{yellow}\colorbox{green}yz", 3, 14, 4, 30,
           l1 => {
     Assert.Null(l1.BackColor);
     Assert.Equal(Structures.Color.PredefinedColors["red"], l1.TextColor);
     TestList(1, 14, 4, 10, 0, 0, LinePosition.Regular, Range.UndefinedInt,
              l2 => {
         Assert.Null(l2.BackColor);
         Assert.Equal(Structures.Color.PredefinedColors["blue"], l2.TextColor);
         TestList(1, 14, 4, 10, 0, 0, LinePosition.Regular, Range.UndefinedInt, d => {
             var line = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
             Assert.Single(line.Atoms);
             AssertText("x", line);
             Assert.Equal(new PointF(), line.Position);
             Assert.False(line.HasScript);
             Assert.Null(line.BackColor);
             Assert.Equal(Structures.Color.PredefinedColors["blue"], line.TextColor);
         })(l2);
     })(l1);
 },
           l1 => {
     Assert.Equal(Structures.Color.PredefinedColors["yellow"], l1.BackColor);
     Assert.Null(l1.TextColor);
     TestList(1, 14, 4, 10, 10, 0, LinePosition.Regular, Range.UndefinedInt,
              l2 => {
         Assert.Equal(Structures.Color.PredefinedColors["green"], l2.BackColor);
         Assert.Null(l2.TextColor);
         TestList(1, 14, 4, 10, 0, 0, LinePosition.Regular, Range.UndefinedInt, d => {
             var line = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
             Assert.Single(line.Atoms);
             AssertText("y", line);
             Assert.Equal(new PointF(), line.Position);
             Assert.False(line.HasScript);
             Assert.Null(line.BackColor);
             Assert.Null(line.TextColor);
         })(l2);
     })(l1);
 }, d => {
     var line = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
     Assert.Single(line.Atoms);
     AssertText("z", line);
     Assert.Equal(new PointF(20, 0), line.Position);
     Assert.False(line.HasScript);
     Assert.Null(line.BackColor);
     Assert.Null(line.TextColor);
 }
           );
 private void UpdatePivots()
 {
     Books.Navigate(typeof(Books), lastSelectedIndex - 1);
     Handouts.Navigate(typeof(Handout), lastSelectedIndex - 1);
     TeacherList.Navigate(typeof(Teachers), lastSelectedIndex - 1);
     TestList.Navigate(typeof(Tests), lastSelectedIndex - 1);
     Timings.Navigate(typeof(Timings), lastSelectedIndex - 1);
 }
Exemplo n.º 27
0
 protected override sealed void OnRun()
 {
     Logger.Debug("OnRun: Enter");
     DefaultBeforeRun();
     TestList.Run();
     DefaultAfterRun();
     Logger.Debug("OnRun: Exit");
 }
Exemplo n.º 28
0
 // Verify elements in type converted list.
 void VerifyTypeConvertedList(IList <int> sourceList, TestList testList)
 {
     Assert.AreEqual(sourceList.Count, testList.Count, "Number of elements is incorrect.");
     for (var i = sourceList.Count - 1; i >= 0; --i)
     {
         Assert.AreEqual(sourceList[i] * 2L, testList[i], $"Element[{i}] is incorrect.");
     }
 }
Exemplo n.º 29
0
 public void TestAccent() =>
 TestOuter(@"\bar{x}", 1, 19, 9, 10.16, d => {
     var accent = Assert.IsType <AccentDisplay <TFont, TGlyph> >(d);
     Assert.Equal(0, accent.Accent.ShiftDown);
     Assert.Equal('\u0304', accent.Accent.Glyph);
     Approximately.Equal(new PointF(0.16f, 5), accent.Accent.Position);
     Assert.False(accent.Accent.HasScript);
     Assert.Equal(new Range(0, 1), accent.Accent.Range);
     TestList(1, 14, 4, 10, 0, 0, LinePosition.Regular, Range.UndefinedInt,
              d => {
         var line = Assert.IsType <TextLineDisplay <TFont, TGlyph> >(d);
         Assert.Single(line.Atoms);
         AssertText("x", line);
         Assert.Equal(new PointF(), line.Position);
         Assert.False(line.HasScript);
     })(accent.Accentee);
 });
Exemplo n.º 30
0
        public void AddExisitingTestShouldAddTestToList()
        {
            var testMock = new Mock <ITest>();
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(testMock.Object);
            Assert.That(testList.Tests.Count() == 1);
        }
        public void test_collection_dirtiness()
        {
            TestList objList = new TestList();
            TestClass objTest = new TestClass();

            objList.Add(objTest);

            objTest.DirtyProp = "test value";

            Assert.IsTrue(objList.IsDirty, "Collection should be dirty.");
        }
        public void test_collection_item_collection_and_property_change_notification()
        {
            TestList objList = new TestList();
            TestClass objTest = new TestClass();
            bool collectionChanged = false;
            bool propertyChanged = false;

            objList.CollectionChanged += (s, e) => collectionChanged = true;

            objList.Add(objTest);

            Assert.IsTrue(collectionChanged, "Collection change should have fired.");

            objList.ItemPropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "DirtyProp")
                    propertyChanged = true;
            };

            objTest.DirtyProp = "test value";

            Assert.IsTrue(propertyChanged, "Item property change should have fired.");
        }
        public void TestSerializeList()
        {
            string recordString = "TestList@values:[1,2,3,4,5]";

            ODocument document = ODocument.Deserialize(recordString);


            TypeMapper<TestList> tm = TypeMapper<TestList>.Instance;
            var t = new TestList();
            tm.ToObject(document, t);

            Assert.IsNotNull(t.values);
            Assert.AreEqual(5, t.values.Count);
            Assert.AreEqual(3, t.values[2]);

            ODocument newODocument = ODocument.ToDocument(t);
            var serialized = newODocument.Serialize();
            Assert.AreEqual(recordString, serialized);
        }
        public void TestSerializeList()
        {
            string recordString = "TestList@values:[1,2,3,4,5]";

            var rawRecord = Encoding.UTF8.GetBytes(recordString);
            ODocument document = serializer.Deserialize(rawRecord, new ODocument());


            TypeMapper<TestList> tm = TypeMapper<TestList>.Instance;
            var t = new TestList();
            tm.ToObject(document, t);

            Assert.NotNull(t.values);
            Assert.Equal(5, t.values.Count);
            Assert.Equal(3, t.values[2]);

            ODocument newODocument = ODocument.ToDocument(t);
            var serialized = Encoding.UTF8.GetString(serializer.Serialize(newODocument));
            Assert.Equal(recordString, serialized);
        }
 public void GetTestList()
 {
     //fake get a list
     Tests = Tests;
 }
 public TestListConfigTest(TestList tests)
 {
     Tests = tests;
 }
Exemplo n.º 37
0
 public IList<TestResponse> Get(TestList request)
 {
     return new List<TestResponse> { new TestResponse { Message = "Item1" }, new TestResponse { Message = "Item2" }, new TestResponse { Message = "Item3" } };
 }
 public void OnBeforeTestListStarted(TestList list)
 {
     browserType = list.Settings.Web.Browser.ToString();
     listName = list.TestListName;
     string date = DateTime.Now.Date.ToShortDateString().Replace("/", "");
        // resultsPath = list.ProjectPath;
        // resultsPath = "C:\\TelerikReports\\" + date;
     //System.IO.Directory.CreateDirectory(resultsPath);
 }
 public TestListConfig(IRunSpace  runSpace)
 {
     ConfigFileName = runSpace.ConfigFile;
     _mainTrace.TraceEvent(TraceEventType.Information, 1021, "ConfigFileName {0} ", ConfigFileName);
     Tests = new TestList();
 }
Exemplo n.º 40
0
 public void OnBeforeTestListStarted(TestList list)
 {
     browserType = list.Settings.Web.Browser.ToString();
 }