public async Task RegisterTaskReturnsJsonWhenThereIsModelStateError() { const string modelStateErrorMessage = "modelStateErrorMessage"; var sut = new TaskApiController(null, null); sut.AddModelStateErrorWithErrorMessage(modelStateErrorMessage); var jsonResult = await sut.RegisterTask(new EventSignupViewModel()) as JsonResult; var result = jsonResult.GetValueForProperty<List<string>>("errors"); Assert.IsType<JsonResult>(jsonResult); Assert.IsType<List<string>>(result); Assert.Equal(result.First(), modelStateErrorMessage); }