added episodes controller unit test and integration test classes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user