public void CalcMinMax_AreEqual()
        {
            TestContext.WriteLine(@"--------------------------------------------------------------------------------");
            TestContext.WriteLine($@"{nameof(CalcMinMax_AreEqual)} start.");

            // 4х жильный кабель.
            var settings = new TableSettings(4);

            settings.RecordsCurrent[0].AddItem("10");
            settings.RecordsCurrent[0].AddItem("20");
            settings.RecordsCurrent[0].AddItem("30");
            settings.RecordsCurrent[0].AddItem("40");
            settings.RecordsCurrent[1].AddItem("50");
            settings.RecordsCurrent[1].AddItem("50");
            settings.RecordsCurrent[1].AddItem("100");
            settings.RecordsCurrent[1].AddItem("50");
            settings.RecordsCurrent[2].AddItem("10");
            settings.RecordsCurrent[2].AddItem("10");
            settings.RecordsCurrent[2].AddItem("10");
            settings.RecordsCurrent[2].AddItem("20");
            settings.Update();
            Assert.AreEqual(1, settings.CalcMaxRow);
            Assert.AreEqual(2, settings.CalcMinRow);
            Assert.AreEqual(4, settings.CalcMaxColCount);
            Assert.AreEqual(250, settings.CalcMaxSum);
            TestContext.WriteLine($@"{nameof(CalcMinMax_AreEqual)} 5.");
            Assert.AreEqual(50, settings.CalcMinSum);

            TestContext.WriteLine($@"{nameof(CalcMinMax_AreEqual)} complete.");
        }
예제 #2
0
 /// <summary>
 /// Помощник холста.
 /// </summary>
 /// <param name="cable"></param>
 /// <param name="page"></param>
 public CanvasHelper(TableSettings cable, PageSettings page)
 {
     // Таблица кабельных жил.
     _cable = cable;
     // Таблица барабанов.
     //_drum = drum;
     // Настройки окна.
     _page       = page;
     CanvasPrint = null;
     _gridMain   = null;
     _gridCanvas = null;
     FontSize    = 12;
 }
 public ProgramSettings()
 {
     // Таблица кабельных жил.
     Cable = new TableSettings(4);
     // Таблица барабанов.
     Drum = new TableSettings(1);
     // Настройки окна.
     Page = new PageSettings();
     // Загрузка не завершена.
     PageEditorIsLoaded    = false;
     PageChangeLogIsLoaded = false;
     WindowMainIsLoaded    = false;
     // Помощник холста.
     Canvas = new CanvasHelper(Cable, Page);
     // По-умолчанию.
     Default();
     // Режим работы.
     Mode = WorkMode.Default;
 }
        public void GetWidthAll_AreEqual()
        {
            TestContext.WriteLine(@"--------------------------------------------------------------------------------");
            TestContext.WriteLine($@"{nameof(GetWidthAll_AreEqual)} start.");

            // 4х жильный кабель.
            var settings = new TableSettings(4);

            settings.RecordsCurrent[0].AddItem("10");
            settings.RecordsCurrent[0].AddItem("20");
            settings.RecordsCurrent[0].AddItem("30");
            settings.RecordsCurrent[0].AddItem("40");
            var actual = settings.GetWidthAll(0);

            TestContext.WriteLine($"actual: {actual}");
            var expected = 100;

            TestContext.WriteLine($"expected: {expected}");
            Assert.AreEqual(expected, actual);

            TestContext.WriteLine($@"{nameof(GetWidthAll_AreEqual)} complete.");
        }
        public void RowsCount_AreEqual()
        {
            TestContext.WriteLine(@"--------------------------------------------------------------------------------");
            TestContext.WriteLine($@"{nameof(RowsCount_AreEqual)} start.");

            var settings = new TableSettings(1);
            var actual   = settings.RowsCount;

            TestContext.WriteLine($"actual: {actual}");
            var expected = 1;

            TestContext.WriteLine($"expected: {expected}");
            Assert.AreEqual(expected, actual);

            settings = new TableSettings();
            actual   = settings.RowsCount;
            TestContext.WriteLine($"actual: {actual}");
            expected = 1;
            TestContext.WriteLine($"expected: {expected}");
            Assert.AreEqual(expected, actual);

            TestContext.WriteLine($@"{nameof(RowsCount_AreEqual)} complete.");
        }