Ejemplo n.º 1
0
 void SortBy(string field)
 {
     txtSortedBy.Text = "Sorted By " + field.Substring(1);
     CustomersVerticalBar[] res2 = (CustomersVerticalBar[])mRecords.Clone();
     CommonEngine.SortRecordsByField(res2, field);
     grid2.SelectedObject = res2;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Sort by field (eg mCountry) and display result in a
        /// grid, replaces the previous sort
        /// </summary>
        /// <param name="field">Field to sort on</param>
        private void SortBy(string field)
        {
            // first character of field is always m, remove it.
            txtSortedBy.Text = "Sorted By " + field.Substring(1);

            CustomersVerticalBar[] res2 = (CustomersVerticalBar[])mRecords.Clone();
            CommonEngine.SortRecordsByField(res2, field);
            grid2.SelectedObject = res2;
        }
Ejemplo n.º 3
0
        public void Sort5()
        {
            engine = new FileHelperEngine(typeof(CustomersSort));

            CustomersSort[] res = engine.ReadFile(TestCommon.TestPath(@"good\Sort1.txt")) as CustomersSort[];
            Assert.AreEqual(8, res.Length);

            CommonEngine.SortRecordsByField(res, "CompanyNameNoExistHere");
        }
Ejemplo n.º 4
0
        public void Sort5()
        {
            var engine = new FileHelperEngine <CustomersSort>();

            CustomersSort[] res = engine.ReadFile(FileTest.Good.Sort1.Path);
            Assert.AreEqual(8, res.Length);

            Assert.Throws <BadUsageException>(()
                                              => CommonEngine.SortRecordsByField(res, "CompanyNameNoExistHere"));
        }
Ejemplo n.º 5
0
        public void Sort2()
        {
            var engine = new FileHelperEngine <CustomersSort>();

            var res = engine.ReadFile(FileTest.Good.Sort1.Path) as CustomersSort[];

            Assert.AreEqual(8, res.Length);

            CommonEngine.SortRecordsByField(res, "CompanyName");

            Assert.AreEqual(8, res.Length);

            Assert.AreEqual("Alfreds Futterkiste", res[0].CompanyName);
            Assert.AreEqual("La maison d'Asie", res[1].CompanyName);
            Assert.AreEqual("Tortuga Restaurante", res[2].CompanyName);
        }
Ejemplo n.º 6
0
        public void Sort2()
        {
            engine = new FileHelperEngine(typeof(CustomersSort));

            CustomersSort[] res = engine.ReadFile(TestCommon.TestPath(@"good\Sort1.txt")) as CustomersSort[];

            Assert.AreEqual(8, res.Length);

            CommonEngine.SortRecordsByField(res, "CompanyName");

            Assert.AreEqual(8, res.Length);

            Assert.AreEqual("Alfreds Futterkiste", res[0].CompanyName);
            Assert.AreEqual("La maison d'Asie", res[1].CompanyName);
            Assert.AreEqual("Tortuga Restaurante", res[2].CompanyName);
        }