A container for messages generated during a timing session.
Inheritance: ModelBase, IMessageProcessor
Esempio n. 1
0
        public void changes_to_the_system_property_raise_the_property_changed_event()
        {
            var model = new MessageModel();
            var observer = model.CreateObserver();

            model.Process(new SetSystemMessageMessage("message"));
            Assert.True(observer.HasChanged(x => x.System));
        }
Esempio n. 2
0
        public void changes_to_the_commentary_property_raise_the_property_changed_event()
        {
            var model = new MessageModel();
            var observer = model.CreateObserver();

            model.Process(new AddCommentaryMessage("commentary"));
            Assert.True(observer.HasChanged(x => x.Commentary));
        }
Esempio n. 3
0
 /// <summary>
 /// Initialises a new instance of the <see cref="SessionModel"/> class.
 /// </summary>
 public SessionModel()
 {
     InnerDrivers = new SortableObservableCollection<DriverModel>((x, y) => { return x.Position.CompareTo(y.Position); });
     Drivers = new ReadOnlyObservableCollection<DriverModel>(InnerDrivers);
     DriversById = new Dictionary<int, DriverModel>(25);
     Feed = new FeedModel();
     Grid = GridModelBase.Create(SessionType.None);
     FastestTimes = new FastestTimesModel(this);
     Messages = new MessageModel();
     OneSecondTimer = new DispatcherTimer(DispatcherPriority.Normal);
     OneSecondTimer.Interval = OneSecond;
     OneSecondTimer.Tick += (s, e) => OnOneSecondElapsed();
     SessionStatus = SessionStatus.Finished;
     SpeedCaptures = new SpeedCapturesModel(this);
     Weather = new WeatherModel();
     Builder = new SessionModelBuilder(this);
 }
Esempio n. 4
0
        public void process_throws_when_message_is_null()
        {
            var model = new MessageModel();

            Assert.Throws<ArgumentNullException>(() => model.Process(null));
        }
Esempio n. 5
0
        public void can_create()
        {
            var model = new MessageModel();

            assert_properties_have_default_values(model);
        }
Esempio n. 6
0
 private void assert_properties_have_default_values(MessageModel model)
 {
     Assert.Null(model.Commentary);
     Assert.Null(model.System);
 }
Esempio n. 7
0
        private static MessageModel CreateModel(params Message[] messagesToProcess)
        {
            var model = new MessageModel();

            foreach(var message in messagesToProcess)
            {
                model.Process(message);
            }

            return model;
        }
            /// <summary>
            /// Initialises a new instance of the <see cref="MessageModelBuilder"/> class and specifies
            /// the <paramref name="model"/> to build.
            /// </summary>
            /// <param name="model">The model to build.</param>
            /// <exception cref="T:System.ArgumentNullException">
            /// Thrown when <paramref name="model"/> is <see langword="null"/>.
            /// </exception>
            public MessageModelBuilder(MessageModel model)
            {
                Guard.NotNull(model, "model");

                Model = model;
            }