Contains all information relating to the current weather condition.
Inheritance: ModelBase, IMessageProcessor
Example #1
0
        public void changes_to_the_is_wet_property_raise_the_property_changed_event()
        {
            var model = new WeatherModel();
            var observer = model.CreateObserver();

            model.Process(new SetIsWetMessage(true));
            Assert.True(observer.HasChanged(x => x.IsWet));
        }
Example #2
0
        public void can_reset()
        {
            var model = new WeatherModel();

            model.AirTemperature.Add(1d);
            model.Humidity.Add(1d);
            model.Process(new SetIsWetMessage(true));
            model.Pressure.Add(1d);
            model.TrackTemperature.Add(1d);
            model.WindAngle.Add(1d);
            model.WindSpeed.Add(1d);

            model.Reset();

            assert_properties_have_default_values(model);
        }
Example #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);
 }
Example #4
0
        public void can_create()
        {
            var model = new WeatherModel();

            assert_properties_have_default_values(model);
        }
Example #5
0
 private void assert_properties_have_default_values(WeatherModel model)
 {
     Assert.Empty(model.AirTemperature.Items);
     Assert.Empty(model.Humidity.Items);
     Assert.False(model.IsWet);
     Assert.Empty(model.Pressure.Items);
     Assert.Empty(model.TrackTemperature.Items);
     Assert.Empty(model.WindAngle.Items);
     Assert.Empty(model.WindSpeed.Items);
 }
Example #6
0
        private static WeatherModel CreateModel(Message messageToProcess)
        {
            var model = new WeatherModel();

            model.Process(messageToProcess);

            return model;
        }
Example #7
0
        public void process_throws_when_message_is_null()
        {
            var model = new WeatherModel();

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

                Model = model;
            }