public void InsertAt_WrongPosition_ThrowsException(double x, double y, 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.InsertAt(x, y, position);
        }
        public void InsertAt_InsertsElementAtGivenPosition_InsertedInProperPlace(double x, double y, int position)
        {
            var expectedPoint = new PointCore(x, y);
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.InsertAt(x, y, position);

            Assert.IsTrue(polygon.Points[position].Equals(expectedPoint));
        }
        public void InsertAt_InsertsElementAtGivenPosition_ElementCountIncreased(double x, double y, int position)
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            int countBefore = polygon.Points.Count;

            polygon.InsertAt(x, y, position);

            Assert.IsTrue(polygon.Points.Count == countBefore + 1);
        }
        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); 
        }
        public void RemoveCurrent_CurrentNotSet_ThrowsException()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.RemoveCurrent();
        }
 public void Insert_InsertsAnElement()
 {
     var polygon = new PolygonCore();
     polygon.Insert(0.1, 1.0);
     Assert.IsTrue(polygon.Points.Count == 1);
 }
        public void TrySelect_SecPointInOffset_SetsSecondPointIndex()
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);

            polygon.TrySelect(0.195, 1.105, 0.01);

            Assert.IsTrue(polygon.CurrentPointIndex == 1);
        }
        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);
        }
 public void TrySelect_PointInOffset_ReturnsTrue(double x, double y, double offset)
 {
     var polygon = new PolygonCore();
     polygon.Insert(0.1, 1.0);
     polygon.Insert(0.2, 1.1);
     polygon.Insert(0.3, 2.0);
     polygon.TrySelect(x, y, offset);
     Assert.IsTrue(polygon.TrySelect(x, y, offset));
 }
        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);
        }
        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);
        }
        public void RemoveAt_RemovesElementPointsCountShouldDecrease(int position)
        {
            var polygon = new PolygonCore();
            polygon.Insert(0.1, 1.0);
            polygon.Insert(0.2, 1.1);
            polygon.Insert(0.3, 2.0);
            int i = polygon.Points.Count;

            polygon.RemoveAt(position);

            Assert.IsTrue(i - polygon.Points.Count == 1);
        }
        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);
        }
        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]);
        }
        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);
        }
        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);
        }