public void Clear_Should_Clear_The_Instance()
        {
            var model    = new CurrentLapDataModel();
            var expected = new CurrentLapDataModel();

            var type = model.GetType();

            var arrayFields = type.GetTypeInfo().DeclaredFields.Where(fi => fi.IsPublic && fi.FieldType.IsArray);

            foreach (var arrayField in arrayFields)
            {
                var arr = arrayField.GetValue(model) as IList;
                for (int i = 0; i < arr.Count; i++)
                {
                    arr[i] = 1.0;
                }
            }

            model.Clear();

            foreach (var arrayField in arrayFields)
            {
                var arr = arrayField.GetValue(model);
                arr.Should().BeEquivalentTo(arrayField.GetValue(expected), because: "clear should reset the instance.");
            }
        }
Beispiel #2
0
        public MainViewModel()
        {
            SetTopmostCommand = new RelayCommand <bool>(SetTopmost);

            for (int i = 0; i < LapData.Length; i++)
            {
                LapData[i] = new CurrentLapDataModel();
            }

            StartListeningCommand = new RelayCommand(async(s) => { await StartListeningAsync(s).ConfigureAwait(false); });

            GraphRenderTimer.Interval = TimeSpan.FromMilliseconds(20);

            Manager.NewSession += Manager_NewSession;
        }