Пример #1
0
        public void TestAddDefaultPositions()
        {
            TimelineEvent evt = new TimelineEvent();

            evt.EventType = new EventType();
            evt.EventType.TagFieldPosition     = false;
            evt.EventType.TagHalfFieldPosition = false;
            evt.EventType.TagGoalPosition      = false;

            Assert.IsNull(evt.FieldPosition);
            Assert.IsNull(evt.HalfFieldPosition);
            Assert.IsNull(evt.GoalPosition);
            evt.AddDefaultPositions();
            Assert.IsNull(evt.FieldPosition);
            Assert.IsNull(evt.HalfFieldPosition);
            Assert.IsNull(evt.GoalPosition);

            evt.EventType.TagFieldPosition = true;
            evt.AddDefaultPositions();
            Assert.IsNotNull(evt.FieldPosition);
            Assert.IsNull(evt.HalfFieldPosition);
            Assert.IsNull(evt.GoalPosition);

            evt.EventType.TagFieldPosition     = false;
            evt.EventType.TagHalfFieldPosition = true;
            evt.AddDefaultPositions();
            Assert.IsNotNull(evt.FieldPosition);
            Assert.IsNotNull(evt.HalfFieldPosition);
            Assert.IsNull(evt.GoalPosition);

            evt.EventType.TagFieldPosition     = false;
            evt.EventType.TagHalfFieldPosition = false;
            evt.EventType.TagGoalPosition      = true;
            evt.AddDefaultPositions();
            Assert.IsNotNull(evt.FieldPosition);
            Assert.IsNotNull(evt.HalfFieldPosition);
            Assert.IsNotNull(evt.GoalPosition);

            /* Adding the default positions doesn't not overwrite the existing data */
            evt.EventType.FieldPositionIsDistance     = true;
            evt.EventType.HalfFieldPositionIsDistance = true;
            evt.FieldPosition.Points [0].X            = 100;
            evt.FieldPosition.Points [0].Y            = 100;
            evt.HalfFieldPosition.Points [0].X        = 100;
            evt.HalfFieldPosition.Points [0].Y        = 100;
            evt.AddDefaultPositions();
            Assert.AreEqual(1, evt.FieldPosition.Points.Count);
            Assert.AreEqual(1, evt.HalfFieldPosition.Points.Count);
            Assert.AreEqual(100, evt.FieldPosition.Points [0].X);
            Assert.AreEqual(100, evt.HalfFieldPosition.Points [0].X);
        }
        public void TestSetEventWithCoordinates()
        {
            Mock <IDrawingToolkit> tkMock = new Mock <IDrawingToolkit> ();
            var timelineEvent             = new TimelineEvent {
                EventType = new EventType()
            };

            timelineEvent.EventType.TagFieldPosition = true;
            timelineEvent.AddDefaultPositions();
            PointLocationView view = new PointLocationView {
                FieldPosition    = FieldPositionType.Field,
                BackgroundWidth  = 100,
                BackgroundHeight = 100,
            };

            view.TimelineEvent = timelineEvent;

            view.Draw(tkMock.Object, null);

            tkMock.Verify(tk => tk.DrawCircle(It.IsAny <Point> (), It.IsAny <double> ()), Times.Once());
        }
Пример #3
0
        public void LoadPlay(TimelineEvent play)
        {
            field.Visible  = play.EventType.TagFieldPosition;
            hfield.Visible = play.EventType.TagHalfFieldPosition;
            goal.Visible   = play.EventType.TagGoalPosition;

            play.AddDefaultPositions();

            if (play.FieldPosition != null)
            {
                field.Tagger.Points = play.FieldPosition.Points;
            }
            if (play.HalfFieldPosition != null)
            {
                hfield.Tagger.Points = play.HalfFieldPosition.Points;
            }
            if (play.GoalPosition != null)
            {
                goal.Tagger.Points = play.GoalPosition.Points;
            }
        }