public async Task ensureGetAlgorithmInputsSucceeds() { var response = await client.GetAsync(urlBase + "/" + (int)RestrictionAlgorithm.WIDTH_PERCENTAGE_ALGORITHM + "/inputs"); var responseString = await response.Content.ReadAsStringAsync(); GetAllInputsModelView list = JsonConvert.DeserializeObject <GetAllInputsModelView>(responseString); Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(new AlgorithmFactory().createAlgorithm(RestrictionAlgorithm.WIDTH_PERCENTAGE_ALGORITHM).getRequiredInputs().Count, list.Count); }
/// <summary> /// Converts an IEnumerable of Input into an instance of GetAllInputsModelView. /// </summary> /// <param name="inputs">IEnumerable of Input being converted.</param> /// <returns>An instance of GetAllInputsModelView representing the provided IEnumerable of Input.</returns> /// <exception cref="System.ArgumentNullException">Thrown when the provided IEnumerable of Input is null.</exception> public static GetAllInputsModelView fromCollection(IEnumerable <Input> inputs) { if (inputs == null) { throw new ArgumentNullException(INPUT_COLLECTION_NULL); } GetAllInputsModelView allInputsModelView = new GetAllInputsModelView(); foreach (Input input in inputs) { allInputsModelView.Add(fromEntity(input)); } return(allInputsModelView); }