public void GetAllReturnsAllValuesNoFilter() { //Given the following setup var controller = new ListifyController(); var expectedValues = Enumerable.Range(0, 100); //Default value assigned is 100 //When the controller is called var values = controller.GetAll(new ListifyFilterModel()); var OkResult = values as OkObjectResult; //Then the response code should match the expected response code Assert.Equal(200, OkResult.StatusCode); Assert.True(((IEnumerable <int>)OkResult.Value).SequenceEqual(expectedValues)); }
public void GetAllRequestValidation(int?minValue, int?maxValue, int expectedResponseCode) { //Given the following setup var controller = new ListifyController(); //When the controller is called var response = controller.GetAll(new ListifyFilterModel() { MinValue = minValue, MaxValue = maxValue }); var statusCode = response as IStatusCodeActionResult; //Then the response code should match the expected response code Assert.Equal(expectedResponseCode, statusCode.StatusCode); }