private async void GetRingAsync() { try { WindowsUpdateRingState state = await this.deviceManagementClient.GetWindowsUpdateRingAsync(); CurrentRingState.Text = state.ring == WindowsUpdateRing.EarlyAdopter ? "Early Adopter" : state.ring == WindowsUpdateRing.GeneralAvailability ? "General Availability" : "Preview"; CurrentRingPriorityState.Text = state.settingsPriority.ToString(); StatusText.Text = "Get Windows Update Ring -> Success"; } catch (Exception ex) { StatusText.Text = "Get Windows Update Ring -> Error: " + ex.HResult + " - " + ex.Message; } }
private async void SetRingAsync() { try { WindowsUpdateRingState ringState = new WindowsUpdateRingState(); ringState.ring = RequestedRingState.SelectedIndex == 0 ? WindowsUpdateRing.EarlyAdopter : RequestedRingState.SelectedIndex == 1 ? WindowsUpdateRing.GeneralAvailability : WindowsUpdateRing.Preview; ringState.settingsPriority = RequestedRingPriorityState.SelectedIndex == 0 ? SettingsPriority.Local : SettingsPriority.Remote; await this.deviceManagementClient.SetWindowsUpdateRingAsync(ringState); StatusText.Text = "Set Windows Update Ring -> Success"; } catch (Exception ex) { StatusText.Text = "Set Windows Update Ring -> Error: " + ex.HResult + " - " + ex.Message; } }
public override async Task <bool> Execute(ILogger logger, TestParameters testParameters) { logger.Log(LoggingLevel.Information, " Executing test case (" + _name + ")..."); JObject resolvedInput = (JObject)testParameters.ResolveParameters(_input); WindowsUpdateRingState state = RingStateFromJson(logger, resolvedInput); await _app.DMClient.SetWindowsUpdateRingAsync(state); logger.Log(LoggingLevel.Information, " Analyzing results..."); Debug.WriteLine("Final Result:"); Debug.WriteLine("Actual Result: " + _actualReportedState.ToString()); List <string> errorList = new List <string>(); bool result = true; Debug.WriteLine("---- Expected Present Result:"); if (_expectedPresentReportedState != null) { Debug.WriteLine(_expectedPresentReportedState.ToString()); result &= TestCaseHelpers.VerifyPropertiesPresent("returnValue", _expectedPresentReportedState, _actualReportedState, errorList); } Debug.WriteLine("---- Expected Absent Result:"); if (_expectedAbsentReportedState != null) { Debug.WriteLine(_expectedAbsentReportedState.ToString()); result &= TestCaseHelpers.VerifyPropertiesAbsent(_expectedAbsentReportedState, _actualReportedState, errorList); } ReportResult(logger, result, errorList); return(result); }
private WindowsUpdateRingState RingStateFromJson(ILogger logger, JObject input) { string ringString; if (!JsonHelpers.TryGetString(input, TCJsonRing, out ringString)) { ReportError(logger, "Missing " + TCJsonRing); return(null); } string settingsPriorityString; if (!JsonHelpers.TryGetString(input, TCJsonSettingsPriority, out settingsPriorityString)) { ReportError(logger, "Missing " + TCJsonSettingsPriority); return(null); } WindowsUpdateRingState state = new WindowsUpdateRingState(); state.ring = WindowsUpdateRingState.RingFromJsonString(ringString); state.settingsPriority = PolicyHelpers.SettingsPriorityFromString(settingsPriorityString); return(state); }