added episodes controller unit test and integration test classes

This commit is contained in:
StevanFreeborn
2022-07-06 11:13:57 -05:00
parent 0a7c522faa
commit 845b1620ef
3 changed files with 46 additions and 2 deletions
@@ -3,8 +3,6 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Testing;
using MongoDB.Bson;
using server.Models;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Text.Json;
@@ -0,0 +1,28 @@
using Microsoft.AspNetCore.Mvc.Testing;
using System.Text.Json;
namespace server.tests.integrationTests
{
public class EpisodesControllerIntegrationTests
{
private readonly HttpClient _client;
private readonly JsonSerializerOptions _serializerOptions;
private readonly string _endpoint;
public EpisodesControllerIntegrationTests()
{
var webAppFactory = new WebApplicationFactory<Program>();
_client = webAppFactory.CreateDefaultClient();
_client.DefaultRequestHeaders.Add("x-api-version", "1");
_serializerOptions = new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
};
_endpoint = "/api/episodes";
}
}
}
@@ -0,0 +1,18 @@
using Moq;
using server.Controllers.v1;
using server.Persistence.Repositories;
namespace server.tests.unitTests
{
public class EpisodesControllerUnitTests
{
private readonly Mock<IEpisodeRepository> _mockRepo;
private readonly EpisodesController _controller;
public EpisodesControllerUnitTests()
{
_mockRepo = new Mock<IEpisodeRepository>();
_controller = new EpisodesController(_mockRepo.Object);
}
}
}