Project 'andrew.cornell/nfa-pruning-analysis' was moved to 'katherine.cornell/nfa-pruning-analysis'. Please update any links and bookmarks that may still have the old path.
Select Git revision
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
DefaultControllerTests.cs 12.23 KiB
using Coscine.Api.Project.Controllers;
using Coscine.Api.Project.Models;
using Coscine.ApiCommons.Utils;
using Coscine.Database.Model;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Routing;
using Moq;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Management;
namespace Coscine.Api.Project.Tests
{
public abstract class DefaultControllerTests<T> where T : Controller
{
protected T Controller { get; }
protected readonly List<Coscine.Database.Model.Project> Projects = new List<Coscine.Database.Model.Project>();
protected readonly List<User> Users = new List<User>();
protected readonly List<ProjectRole> ProjectRoles = new List<ProjectRole>();
protected readonly List<ResourceType> ResourceTypes = new List<ResourceType>();
protected readonly List<Resource> Resources = new List<Resource>();
protected readonly List<ResourceDiscipline> ResourceDisciplines = new List<ResourceDiscipline>();
protected Discipline Discipline { get; set; }
protected Institute Institute { get; set; }
protected Visibility Visibility { get; set; }
protected License License { get; set; }
protected RDSResourceType RdsResourceType { get; set; }
protected int Previous;
protected DefaultControllerTests(T controller)
{
Controller = controller;
}
[OneTimeSetUp]
public void Setup()
{
DisciplineModel disciplineModel = new DisciplineModel();
Discipline = new Discipline()
{
DisplayNameDe = "TestDiscipline",
DisplayNameEn = "TestDiscipline",
Url = "http://rwth-aachen.de"
};
disciplineModel.Insert(Discipline);
InstituteModel instituteModel = new InstituteModel();
Institute = new Institute()
{
DisplayName = "TestInstitute",
IKZ = "022000"
};
instituteModel.Insert(Institute);
VisibilityModel visibilityModel = new VisibilityModel();
Visibility = visibilityModel.GetWhere((visibility) => visibility.DisplayName == "Public");
LicenseModel licenseModel = new LicenseModel();
License = new License()
{
DisplayName = "MIT"
};