public void Execute_Can_deal_with_space_overlapping_points()
        {
            var inputRoute = new TestRouteBuilder()
                             .WithTrackPointCount(3)
                             .WithCoursePointsAt(0)
                             .Build();
            var tLast = TestRouteBuilder.GetTimeStamp(3);

            inputRoute.TrackPoints.Add(TestRouteBuilder.GetTrackPoint(0));
            inputRoute.TrackPoints.Last().TimeStamp = tLast;

            var newPoint = TestRouteBuilder.GetCoursePoint(0);

            newPoint.TimeStamp = tLast;
            var result = _sut.Execute(
                new AddCoursePointInput
            {
                Route          = inputRoute,
                NewCoursePoint = newPoint
            });

            result.Route.CoursePoints.Count.ShouldBe(2);
            result.Route.CoursePoints[0].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(0));
            result.Route.CoursePoints[1].TimeStamp.ShouldBe(tLast);
        }
Exemple #2
0
        public void Execute_should_delete_point_if_1_point()
        {
            var inputRoute = new TestRouteBuilder()
                             .WithTrackPointCount(3)
                             .WithCoursePointsAt(1)
                             .Build();

            var result = _sut.Execute(
                new DeleteCoursePointInput
            {
                Route     = inputRoute,
                TimeStamp = TestRouteBuilder.GetTimeStamp(1)
            });

            result.Route.CoursePoints.ShouldBeEmpty();
        }
Exemple #3
0
        public void Execute_should_delete_point_if_many_points()
        {
            var inputRoute = new TestRouteBuilder()
                             .WithTrackPointCount(10)
                             .WithCoursePointsAt(3, 6, 9)
                             .Build();

            var result = _sut.Execute(
                new DeleteCoursePointInput
            {
                Route     = inputRoute,
                TimeStamp = TestRouteBuilder.GetTimeStamp(6)
            });

            result.Route.CoursePoints.Count.ShouldBe(2);
            result.Route.CoursePoints[0].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(3));
            result.Route.CoursePoints[1].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(9));
        }
        public void Execute_Should_add_at_begin_if_CP_belongs_to_earlier_TP_than_other_CPs()
        {
            var inputRoute = new TestRouteBuilder()
                             .WithTrackPointCount(3)
                             .WithCoursePointsAt(1)
                             .Build();

            var result = _sut.Execute(
                new AddCoursePointInput
            {
                Route          = inputRoute,
                NewCoursePoint = TestRouteBuilder.GetCoursePoint(0)
            });

            result.Route.CoursePoints.Count.ShouldBe(2);
            result.Route.CoursePoints[0].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(0));
            result.Route.CoursePoints[1].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(1));
        }
        public void Execute_Should_insert_point_at_time_order()
        {
            var inputRoute = new TestRouteBuilder()
                             .WithTrackPointCount(3)
                             .WithCoursePointsAt(0, 2)
                             .Build();

            var result = _sut.Execute(
                new AddCoursePointInput
            {
                Route          = inputRoute,
                NewCoursePoint = TestRouteBuilder.GetCoursePoint(1)
            });

            result.Route.CoursePoints.Count.ShouldBe(3);
            result.Route.CoursePoints[0].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(0));
            result.Route.CoursePoints[1].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(1));
            result.Route.CoursePoints[2].TimeStamp.ShouldBe(TestRouteBuilder.GetTimeStamp(2));
        }