コード例 #1
0
        public void RemoveCurrent_CurrentSet_RemovesCurrentSelectedPointShouldBeNull()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            polygon.Select(1);

            polygon.RemoveCurrent();

            Assert.IsTrue(polygon.CurrentPoint == null); 
        }
コード例 #2
0
        public void Select_ProperIndex_ShouldSelect(int position)
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.Select(position);
        }
コード例 #3
0
        public void Select_ProperIndex_ShouldSelectProperPointIndex()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.Select(1);

            Assert.IsTrue(polygon.CurrentPointIndex == 1);
        }
コード例 #4
0
        public void Select_InvalidIndex_ThrowsException(int position)
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.Select(position);
        }
コード例 #5
0
        public void RemoveAt_RemovesElementPointAtPositionIndexShouldChange()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            polygon.Select(1);
            int positionBefore = polygon.CurrentPointIndex;

            polygon.RemoveAt(0);

            Assert.IsTrue(positionBefore != polygon.CurrentPointIndex);
        }
コード例 #6
0
        public void RemoveAt_RemovesElementPointAtPositionShouldChange()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            polygon.Select(1);
            var pointAt1 = polygon.Points[1];

            polygon.RemoveAt(1);

            Assert.IsTrue(pointAt1 != polygon.Points[1]);
        }
コード例 #7
0
        public void RemoveAt_RemovesCurrentSelectedPointIndexShouldBeMinusOne()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            polygon.Select(1);

            polygon.RemoveAt(1);

            Assert.IsTrue(polygon.CurrentPointIndex == -1);
        }
コード例 #8
0
        public void RemoveCurrent_CurrentSet_RemovesCurrentSelectedPointsCountShouldDecrease()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            polygon.Select(1);
            int i = polygon.Points.Count;

            polygon.RemoveCurrent();

            Assert.IsTrue(i - polygon.Points.Count == 1);
        }