public async Task TestDataReadEndpoints() { var(result, status) = await _zipato.DataReadEndpointsAsync(); Assert.Equal(DataValue.Good, status); Assert.NotEmpty(result); }
public async Task <IActionResult> GetEndpointsAsync(bool update = false) { try { _logger?.LogDebug("GetEndpointsAsync()..."); if (!_zipato.IsLocked) { return(StatusCode(StatusCodes.Status406NotAcceptable, "Locked: update not yet finished.")); } if (update) { var(endpoints, status) = await _zipato.DataReadEndpointsAsync(); if (status.IsGood) { return(Ok(endpoints)); } else { return(StatusCode(StatusCodes.Status502BadGateway, status)); } } else { var endpoints = _zipato.Data.Endpoints.Select(e => e.ToEndpointData()).ToList(); return(Ok(endpoints)); } } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }