diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API.Tests/TestHelpers/ControllerTestHelper.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API.Tests/TestHelpers/ControllerTestHelper.cs index 738b87e..c667776 100644 --- a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API.Tests/TestHelpers/ControllerTestHelper.cs +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API.Tests/TestHelpers/ControllerTestHelper.cs @@ -1,6 +1,18 @@ +using Microsoft.AspNetCore.Mvc; +using NUnit.Framework; + namespace LeedsBeerQuest.API.Tests.TestHelpers; -public class ControllerTestHelper +public static class ControllerTestHelper { - + public static T ActionResultToOkResultValue(IActionResult actionResult) where T : class + { + var okResult = actionResult as OkObjectResult; + Assert.NotNull(okResult); + + var resultValue = okResult!.Value as T; + Assert.NotNull(resultValue); + + return resultValue!; + } } \ No newline at end of file