public void CheckReportCreation(List<string> text, string expected)
        {
            OrderedList testObject = new OrderedList(text);
            string actual = testObject.Create();

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void AddShouldSort()
        {
            var list = OrderedList <int> .Create(n => n);

            list.Add(2);
            list.Add(-1);
            list.Add(3);
            list.Add(0);

            Assert.Equal(new[] { -1, 0, 2, 3 }, list);
            list.AssertIsSorted(o => o);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <string> text = new List <string>();

            DA.GetDataList(0, text);

            string      report;
            OrderedList reportObject = new OrderedList(text);

            report = reportObject.Create();

            DA.SetData(0, report);
        }
예제 #4
0
        public void AddItemWithSameOrderValueShouldBeAddedToEndOfGroup()
        {
            var list = OrderedList <TestObj> .Create(n => n.Order);

            list.Add(new TestObj(2));
            list.Add(new TestObj(2));
            list.Add(new TestObj(3));
            var thirdObject = new TestObj(2);

            list.Add(thirdObject);

            Assert.Equal(thirdObject, list[2]);
            list.AssertIsSorted(o => o.Order);
        }
예제 #5
0
        public void ItemShouldBeMovedOnOrderPropertyChanged()
        {
            var list = OrderedList <TestNotifyObj> .Create(n => n.Order);

            var o1   = new TestNotifyObj(2);
            var o2   = new TestNotifyObj(3);
            var o0_1 = new TestNotifyObj(1);

            list.Add(o1);
            list.Add(o2);
            var testObj = o0_1;

            list.Add(testObj);

            Assert.Equal(new [] { o0_1, o1, o2 }, list);

            testObj.Order = 2;

            Assert.Equal(new[] { o1, o0_1, o2 }, list);

            list.AssertIsSorted(o => o.Order);
        }