Esempio n. 1
0
        public void RespositoryServiceTest()
        {
            List <Product> products = new List <Product>()
            {
                new Product {
                    Name = "ProductNameA", Price = 99.99M, Quantity = 0
                },
                new Product {
                    Name = "ProductNameB", Price = 101.99M, Quantity = 0
                },
                new Product {
                    Name = "ProductNameC", Price = 10.99M, Quantity = 0
                },
                new Product {
                    Name = "ProductNameD", Price = 5M, Quantity = 0
                },
                new Product {
                    Name = "ProductNameF", Price = 999999999999M, Quantity = 0
                }
            };

            SortBL sortBl = new SortBL();
            var    result = sortBl.SortProducts(products, null, SortOption.Descending);

            Assert.AreEqual(result[0].Name, "ProductNameF");
        }
Esempio n. 2
0
        private void SravBTN_Click(object sender, EventArgs e)
        {
            graphicCH.ChartAreas[0].CursorX.IsUserEnabled              = true;
            graphicCH.ChartAreas[0].CursorX.IsUserSelectionEnabled     = true;
            graphicCH.ChartAreas[0].AxisX.ScaleView.Zoomable           = true;
            graphicCH.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;

            graphicCH.ChartAreas[0].CursorY.IsUserEnabled              = true;
            graphicCH.ChartAreas[0].CursorY.IsUserSelectionEnabled     = true;
            graphicCH.ChartAreas[0].AxisY.ScaleView.Zoomable           = true;
            graphicCH.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = true;
            if (KObmenRBTN.Checked)
            {
                graphicCH.Series[0].Points.Clear();
                graphicCH.Series[1].Points.Clear();
                //               int[] arr = DGVToArr(DGV);
                for (int i = 0; i < draw_Arr.Length; i++)
                {
                    int[]  tempArr = draw_Arr.Take(i).ToArray();
                    SortBL sort    = new SortBL(tempArr.Length, tempArr);
                    sort.SortShell();
                    graphicCH.Series[1].Points.AddXY(i, sort.ReturnObm());
                    sort.BubleSort();
                    graphicCH.Series[0].Points.AddXY(i, sort.ReturnObm());
                }
            }
            else if (KSravRBTN.Checked)
            {
                graphicCH.Series[0].Points.Clear();
                graphicCH.Series[1].Points.Clear();
                int[] arr = DGVToArr(DGV);
                for (int i = 0; i < arr.Length; i++)
                {
                    int[]  tempArr = arr.Take(i).ToArray();
                    SortBL sort    = new SortBL(tempArr.Length, tempArr);
                    sort.SortShell();
                    graphicCH.Series[1].Points.AddXY(i, sort.ReturnSrav());
                    sort.BubleSort();
                    graphicCH.Series[0].Points.AddXY(i, sort.ReturnSrav());
                }
            }
            else
            {
                MessageBox.Show("Выберите тип графика для построения.");
            }
        }
Esempio n. 3
0
        private void SortBTN_Click(object sender, EventArgs e)
        {
            int[]  arr  = DGVToArr(DGV);
            SortBL sort = new SortBL(arr.Length, arr);

            if (ShellRBTN.Checked)
            {
                sort.SortShell();
                ClearDGV(DGV);
                ArrToDGV(arr, DGV);
            }
            else if (BubleRBTN.Checked)
            {
                sort.BubleSort();
                ClearDGV(DGV);
                ArrToDGV(arr, DGV);
            }
            else
            {
                MessageBox.Show("Выберите вид сортировки");
            }
        }