/// <summary> /// Set the drive speed based on reported maximum and user-defined option /// </summary> private void SetSupportedDriveSpeed() { // Set the drive speed list that's appropriate var values = AllowedSpeeds.GetForMediaType(_currentMediaType); DriveSpeedComboBox.ItemsSource = values; ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values)); // Choose the lower of the two speeds between the allowed speeds and the user-defined one int chosenSpeed = Math.Min( values.Where(s => s <= values[values.Count / 2]).Last(), _options.preferredDumpSpeedCD ); // Set the selected speed ViewModels.LoggerViewModel.VerboseLogLn("Setting drive speed to: {0}", chosenSpeed); DriveSpeedComboBox.SelectedValue = chosenSpeed; }
[InlineData(null, 72)] // TODO: Update when fully determined public void GetAllowedDriveSpeedForMediaTypeTest(MediaType?mediaType, int maxExpected) { var actual = AllowedSpeeds.GetForMediaType(mediaType); Assert.Equal(maxExpected, actual.Last()); }