diff --git a/backend/cinemateketTests/ControllerTests/MovieControllerTests.cs b/backend/cinemateketTests/ControllerTests/MovieControllerTests.cs new file mode 100644 index 0000000..5bd3d5c --- /dev/null +++ b/backend/cinemateketTests/ControllerTests/MovieControllerTests.cs @@ -0,0 +1,37 @@ +using Xunit; +using Moq; +using backend; +using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; + +public class MovieControllerTests +{ + private readonly Mock> _mockLogger; + private readonly Mock _mockDbContext; + + public MovieControllerTests() + { + _mockLogger = new Mock>(); + var options = new DbContextOptionsBuilder() + .UseInMemoryDatabase(databaseName: "MovieDatabase") + .Options; + _mockDbContext = new Mock(options); + } + + [Fact] + public void GetMovies_ValidQueryParams_ReturnsOk() + { + // Arrange + var controller = new MovieController(_mockLogger.Object, _mockDbContext.Object); + + // Act + var result = controller.Get("Star Wars", "movie", "2021", "titleasc", 1, 5); + + // Assert + Assert.IsType(result.Result); + } + +} \ No newline at end of file diff --git a/backend/cinemateketTests/cinemateketTests.csproj b/backend/cinemateketTests/cinemateketTests.csproj index 084a522..1b01a3a 100644 --- a/backend/cinemateketTests/cinemateketTests.csproj +++ b/backend/cinemateketTests/cinemateketTests.csproj @@ -9,12 +9,14 @@ + runtime; build; native; contentfiles; analyzers; buildtransitive all +