Commit ea903e3a authored by Benedikt Heinrichs's avatar Benedikt Heinrichs
Browse files

New: Delete functionality for Projects and Resources and additional fields

parent 4990362b
using Coscine.Api.Project.Models; using Coscine.Api.Project.Controllers;
using Coscine.Api.Project.Models;
using Coscine.ApiCommons.Utils; using Coscine.ApiCommons.Utils;
using Coscine.Database.Model; using Coscine.Database.Model;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
...@@ -24,6 +25,13 @@ namespace Coscine.Api.Project.Tests ...@@ -24,6 +25,13 @@ namespace Coscine.Api.Project.Tests
protected readonly List<ProjectRole> ProjectRoles = new List<ProjectRole>(); protected readonly List<ProjectRole> ProjectRoles = new List<ProjectRole>();
protected readonly List<ResourceType> ResourceTypes = new List<ResourceType>(); protected readonly List<ResourceType> ResourceTypes = new List<ResourceType>();
protected readonly List<Resource> Resources = new List<Resource>(); 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 int Previous;
...@@ -35,6 +43,32 @@ namespace Coscine.Api.Project.Tests ...@@ -35,6 +43,32 @@ namespace Coscine.Api.Project.Tests
[OneTimeSetUp] [OneTimeSetUp]
public void Setup() public void Setup()
{ {
DisciplineModel disciplineModel = new DisciplineModel();
Discipline = new Discipline()
{
DisplayName = "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"
};
licenseModel.Insert(License);
ProjectModel projectModel = new ProjectModel(); ProjectModel projectModel = new ProjectModel();
Previous = projectModel.GetAll().ToArray().Length; Previous = projectModel.GetAll().ToArray().Length;
...@@ -54,63 +88,120 @@ namespace Coscine.Api.Project.Tests ...@@ -54,63 +88,120 @@ namespace Coscine.Api.Project.Tests
var project = new Coscine.Database.Model.Project() var project = new Coscine.Database.Model.Project()
{ {
Description = "Description", Description = "Description",
Organization = "Organization", ProjectName = "TestProject",
DisplayName = "TestProject", DisplayName = "TestProject",
StartDate = DateTime.Now, StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1), EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2" Keywords = "Test1;Test2",
GrantId = "testid",
PrincipleInvestigators = "TestInvestigator",
VisibilityId = Visibility.Id
}; };
projectModel.Insert(project); projectModel.Insert(project);
var projectRole = projectModel.SetOwner(project, user); var projectRole = projectModel.SetOwner(project, user);
ProjectRoles.Add(projectRole); ProjectRoles.Add(projectRole);
ProjectDisciplineModel projectDisciplineModel = new ProjectDisciplineModel();
projectDisciplineModel.Insert(new ProjectDiscipline()
{
DisciplineId = Discipline.Id,
ProjectId = project.Id
});
ProjectInstituteModel projectInstituteModel = new ProjectInstituteModel();
projectInstituteModel.Insert(new ProjectInstitute()
{
InstituteId = Institute.Id,
ProjectId = project.Id
});
Projects.Add(projectModel.GetById(project.Id)); Projects.Add(projectModel.GetById(project.Id));
var project2 = new Coscine.Database.Model.Project() var project2 = new Coscine.Database.Model.Project()
{ {
Description = "Description2", Description = "Description2",
Organization = "Organization2", ProjectName = "TestProject",
DisplayName = "TestProject2", DisplayName = "TestProject2",
StartDate = DateTime.Now, StartDate = DateTime.Now,
EndDate = DateTime.Now.AddYears(1), EndDate = DateTime.Now.AddYears(1),
Keywords = "Test1;Test2" Keywords = "Test1;Test2",
GrantId = "testid",
PrincipleInvestigators = "TestInvestigator",
VisibilityId = Visibility.Id
}; };
projectModel.Insert(project2); projectModel.Insert(project2);
Projects.Add(projectModel.GetById(project2.Id)); Projects.Add(projectModel.GetById(project2.Id));
ResourceTypeModel resourceTypeModel = new ResourceTypeModel(); ResourceTypeModel resourceTypeModel = new ResourceTypeModel();
var resourceType = new ResourceType() var resourceType = resourceTypeModel.GetWhere((dbResourceType) => dbResourceType.DisplayName == "rds");
RDSResourceTypeModel rdsResourceTypeModel = new RDSResourceTypeModel();
RdsResourceType = new RDSResourceType()
{ {
DisplayName = "TestType" AccessKey = "a",
SecretKey = "b",
BucketName = "c",
}; };
resourceTypeModel.Insert(resourceType); rdsResourceTypeModel.Insert(RdsResourceType);
ResourceTypes.Add(resourceType);
ResourceModel resourceModel = new ResourceModel(); ResourceModel resourceModel = new ResourceModel();
var resource = new Resource() var resource = new Resource()
{ {
ExternalId = "123",
Url = "http://rwth-aachen.de/test",
DisplayName = "ResourceTest1", DisplayName = "ResourceTest1",
ResourceName = "ResourceTest1",
Keywords = "ResourceTest1",
UsageRights = "ResourceTest1",
TypeId = resourceType.Id, TypeId = resourceType.Id,
Type = resourceType Type = resourceType,
Visibility = Visibility,
VisibilityId = Visibility.Id,
LicenseId = License.Id,
ResourceTypeOptionId = RdsResourceType.Id
}; };
resourceModel.Insert(resource); resourceModel.Insert(resource);
projectModel.AddResource(project, resource); projectModel.AddResource(project, resource);
Resources.Add(resource); Resources.Add(resource);
resourceType = resourceTypeModel.GetWhere((dbResourceType) => dbResourceType.DisplayName == "gitlab");
var resource2 = new Resource() var resource2 = new Resource()
{ {
ExternalId = "12345",
Url = "http://rwth-aachen.de/test2",
DisplayName = "ResourceTest2", DisplayName = "ResourceTest2",
ResourceName = "ResourceTest2",
Keywords = "ResourceTest2",
UsageRights = "ResourceTest2",
TypeId = resourceType.Id, TypeId = resourceType.Id,
Type = resourceType Type = resourceType,
Visibility = Visibility,
VisibilityId = Visibility.Id,
LicenseId = License.Id
}; };
resourceModel.Insert(resource2); resourceModel.Insert(resource2);
projectModel.AddResource(project2, resource2); projectModel.AddResource(project2, resource2);
Resources.Add(resource2); Resources.Add(resource2);
ResourceDisciplineModel resourceDisciplineModel = new ResourceDisciplineModel();
ResourceDiscipline resourceDiscipline = new ResourceDiscipline()
{
DisciplineId = Discipline.Id,
ResourceId = resource.Id
};
resourceDisciplineModel.Insert(resourceDiscipline);
ResourceDisciplines.Add(resourceDiscipline);
resourceDiscipline = new ResourceDiscipline()
{
DisciplineId = Discipline.Id,
ResourceId = resource2.Id
};
resourceDisciplineModel.Insert(resourceDiscipline);
ResourceDisciplines.Add(resourceDiscipline);
} }
...@@ -193,26 +284,43 @@ namespace Coscine.Api.Project.Tests ...@@ -193,26 +284,43 @@ namespace Coscine.Api.Project.Tests
{ {
projectResourceModel.Delete(projectResource); projectResourceModel.Delete(projectResource);
} }
ProjectModel projectModel = new ProjectModel(); ProjectController projectController = new ProjectController();
foreach (var project in Projects) foreach (var project in Projects)
{ {
projectModel.Delete(project); projectController.DeleteProject(project);
} }
UserModel userModel = new UserModel(); UserModel userModel = new UserModel();
foreach (var user in Users) foreach (var user in Users)
{ {
userModel.Delete(user); userModel.Delete(user);
} }
ResourceDisciplineModel resourceDisciplineModel = new ResourceDisciplineModel();
foreach (var resourceDiscipline in ResourceDisciplines)
{
resourceDisciplineModel.Delete(resourceDiscipline);
}
ResourceModel resourceModel = new ResourceModel(); ResourceModel resourceModel = new ResourceModel();
foreach (var resource in Resources) foreach (var resource in Resources)
{ {
resourceModel.Delete(resource); resourceModel.DeleteResource(resource);
} }
ResourceTypeModel resourceTypeModel = new ResourceTypeModel(); ResourceTypeModel resourceTypeModel = new ResourceTypeModel();
foreach (var resourceType in ResourceTypes) foreach (var resourceType in ResourceTypes)
{ {
resourceTypeModel.Delete(resourceType); resourceTypeModel.Delete(resourceType);
} }
DisciplineModel disciplineModel = new DisciplineModel();
disciplineModel.Delete(Discipline);
InstituteModel instituteModel = new InstituteModel();
instituteModel.Delete(Institute);
LicenseModel licenseModel = new LicenseModel();
licenseModel.Delete(License);
RDSResourceTypeModel rdsResourceTypeModel = new RDSResourceTypeModel();
rdsResourceTypeModel.Delete(RdsResourceType);
} }
} }
} }
\ No newline at end of file
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
<Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL"> <Reference Include="Coscine.Configuration, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ce3d7a32d7dc1e5a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath> <HintPath>..\packages\Coscine.Configuration.1.4.0\lib\net461\Coscine.Configuration.dll</HintPath>
</Reference> </Reference>
<Reference Include="Coscine.Database, Version=1.5.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL"> <Reference Include="Coscine.Database, Version=1.6.0.0, Culture=neutral, PublicKeyToken=767d77427707b70a, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.Database.1.5.0\lib\net461\Coscine.Database.dll</HintPath> <HintPath>..\packages\Coscine.Database.1.6.0\lib\net461\Coscine.Database.dll</HintPath>
</Reference> </Reference>
<Reference Include="Coscine.ProxyApi, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Coscine.ProxyApi, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Coscine.ProxyApi.1.2.0\lib\net461\Coscine.ProxyApi.dll</HintPath> <HintPath>..\packages\Coscine.ProxyApi.1.2.0\lib\net461\Coscine.ProxyApi.dll</HintPath>
...@@ -565,6 +565,7 @@ ...@@ -565,6 +565,7 @@
<Compile Include="ProjectControllerTests.cs" /> <Compile Include="ProjectControllerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceControllerTests.cs" /> <Compile Include="ResourceControllerTests.cs" />
<Compile Include="ResourceTypeControllerTests.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
......
...@@ -8,6 +8,7 @@ using System.IO; ...@@ -8,6 +8,7 @@ using System.IO;
using System; using System;
using Coscine.ApiCommons.Exceptions; using Coscine.ApiCommons.Exceptions;
using Coscine.ApiCommons.Factories; using Coscine.ApiCommons.Factories;
using System.Collections.Generic;
#region DupFinder Exclusion #region DupFinder Exclusion
namespace Coscine.Api.Project.Tests namespace Coscine.Api.Project.Tests
...@@ -57,7 +58,6 @@ namespace Coscine.Api.Project.Tests ...@@ -57,7 +58,6 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(projectObject.Id == Projects[0].Id); Assert.IsTrue(projectObject.Id == Projects[0].Id);
Assert.IsTrue(projectObject.Description == Projects[0].Description); Assert.IsTrue(projectObject.Description == Projects[0].Description);
Assert.IsTrue(projectObject.DisplayName == Projects[0].DisplayName); Assert.IsTrue(projectObject.DisplayName == Projects[0].DisplayName);
Assert.IsTrue(projectObject.Organization == Projects[0].Organization);
Assert.IsTrue(projectObject.StartDate == Projects[0].StartDate); Assert.IsTrue(projectObject.StartDate == Projects[0].StartDate);
Assert.IsTrue(projectObject.EndDate == Projects[0].EndDate); Assert.IsTrue(projectObject.EndDate == Projects[0].EndDate);
Assert.IsTrue(projectObject.Keywords == Projects[0].Keywords); Assert.IsTrue(projectObject.Keywords == Projects[0].Keywords);
...@@ -103,8 +103,11 @@ namespace Coscine.Api.Project.Tests ...@@ -103,8 +103,11 @@ namespace Coscine.Api.Project.Tests
[Test] [Test]
public void TestControllerStore() public void TestControllerStore()
{ {
ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", "NewOrganisation", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3"); ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName));
var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject); var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
...@@ -120,7 +123,6 @@ namespace Coscine.Api.Project.Tests ...@@ -120,7 +123,6 @@ namespace Coscine.Api.Project.Tests
Assert.IsTrue(createdProjectObject.Description == newProjectObject.Description); Assert.IsTrue(createdProjectObject.Description == newProjectObject.Description);
Assert.IsTrue(createdProjectObject.DisplayName == newProjectObject.DisplayName); Assert.IsTrue(createdProjectObject.DisplayName == newProjectObject.DisplayName);
Assert.IsTrue(createdProjectObject.Organization == newProjectObject.Organization);
Assert.IsTrue(createdProjectObject.StartDate == newProjectObject.StartDate); Assert.IsTrue(createdProjectObject.StartDate == newProjectObject.StartDate);
Assert.IsTrue(createdProjectObject.EndDate == newProjectObject.EndDate); Assert.IsTrue(createdProjectObject.EndDate == newProjectObject.EndDate);
Assert.IsTrue(createdProjectObject.Keywords == newProjectObject.Keywords); Assert.IsTrue(createdProjectObject.Keywords == newProjectObject.Keywords);
...@@ -130,19 +132,94 @@ namespace Coscine.Api.Project.Tests ...@@ -130,19 +132,94 @@ namespace Coscine.Api.Project.Tests
ProjectModel projectModel = new ProjectModel(); ProjectModel projectModel = new ProjectModel();
var project = projectModel.GetById(createdProjectObject.Id); var project = projectModel.GetById(createdProjectObject.Id);
ProjectRoleModel projectRoleModel = new ProjectRoleModel(); Controller.DeleteProject(project);
var projectRoles = projectRoleModel.GetAllWhere((x) => x.ProjectId == project.Id); }
foreach (var projectRole in projectRoles)
{
projectRoleModel.Delete(projectRole); [Test]
} public void TestControllerDelete()
projectModel.Delete(project); {
ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName));
var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
FakeControllerContext(Users[0], stream);
var actionResult = Controller.Store();
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult));
OkObjectResult okObjectResult = (OkObjectResult)actionResult;
Assert.IsTrue(okObjectResult.Value.GetType() == typeof(ProjectObject));
ProjectObject createdProjectObject = (ProjectObject)okObjectResult.Value;
stream.Close();
stream = ObjectFactory<ProjectObject>.SerializeToStream(createdProjectObject);
FakeControllerContext(Users[0], stream);
actionResult = Controller.Delete(createdProjectObject.Id.ToString());
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult));
okObjectResult = (OkObjectResult)actionResult;
Assert.IsTrue(okObjectResult.Value.GetType() == typeof(ProjectObject));
stream.Close();
}
[Test]
public void TestControllerDeleteWithSubProjects()
{
ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName));
var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
FakeControllerContext(Users[0], stream);
var actionResult = Controller.Store();
OkObjectResult okObjectResult = (OkObjectResult)actionResult;
ProjectObject createdProjectObject = (ProjectObject)okObjectResult.Value;
stream.Close();
newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName),
createdProjectObject.Id);
stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
FakeControllerContext(Users[0], stream);
actionResult = Controller.Store();
stream = ObjectFactory<ProjectObject>.SerializeToStream(createdProjectObject);
FakeControllerContext(Users[0], stream);
actionResult = Controller.Delete(createdProjectObject.Id.ToString());
Assert.IsTrue(actionResult.GetType() == typeof(OkObjectResult));
okObjectResult = (OkObjectResult)actionResult;
Assert.IsTrue(okObjectResult.Value.GetType() == typeof(ProjectObject));
stream.Close();
} }
[Test] [Test]
public void TestControllerStoreWithSubProject() public void TestControllerStoreWithSubProject()
{ {
ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", "NewOrganisation", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3"); ProjectObject newProjectObject = new ProjectObject(Guid.NewGuid(), "NewProject", "NewDisplayName", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName));
var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject); var stream = ObjectFactory<ProjectObject>.SerializeToStream(newProjectObject);
FakeControllerContext(Users[0], stream); FakeControllerContext(Users[0], stream);
...@@ -151,7 +228,11 @@ namespace Coscine.Api.Project.Tests ...@@ -151,7 +228,11 @@ namespace Coscine.Api.Project.Tests
OkObjectResult okObjectResult = (OkObjectResult)actionResult; OkObjectResult okObjectResult = (OkObjectResult)actionResult;
ProjectObject createdProjectObject = (ProjectObject)okObjectResult.Value; ProjectObject createdProjectObject = (ProjectObject)okObjectResult.Value;
ProjectObject newSubProjectObject = new ProjectObject(Guid.NewGuid(), "NewSubProject", "NewDisplayNameSub", "NewOrganisation", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", createdProjectObject.Id); ProjectObject newSubProjectObject = new ProjectObject(Guid.NewGuid(), "NewSubProject", "NewDisplayNameSub", DateTime.Now, DateTime.Now.AddYears(1), "test2;test3", "abc", "investigator", "grandId",
new List<DisciplineObject>() { new DisciplineObject(Discipline.Id, Discipline.Url, Discipline.DisplayName) },
new List<InstituteObject>() { new InstituteObject(Institute.Id, Institute.IKZ, Institute.DisplayName) },
new VisibilityObject(Visibility.Id, Visibility.DisplayName),
createdProjectObject.Id);
var subStream = ObjectFactory<ProjectObject>.SerializeToStream(newSubProjectObject); var subStream = ObjectFactory<ProjectObject>.SerializeToStream(newSubProjectObject);
FakeControllerContext(Users[0], subStream); FakeControllerContext(Users[0], subStream);
...@@ -174,32 +255,7 @@ namespace Coscine.Api.Project.Tests ...@@ -174,32 +255,7 @@ namespace Coscine.Api.Project.Tests
ProjectModel projectModel = new ProjectModel(); ProjectModel projectModel = new ProjectModel();
var project = projectModel.GetById(createdProjectObject.Id); var project = projectModel.GetById(createdProjectObject.Id);
Controller.DeleteProject(project);
SubProjectModel subProjectModel1 = new SubProjectModel();
var subProjects1 = subProjectModel1.GetAllWhere((x) => x.ProjectId == project.Id);
foreach (var subProject in subProjects1)
{
subProjectModel1.Delete(subProject);
}
ProjectRoleModel projectRoleModel = new ProjectRoleModel();
var projectRoles = projectRoleModel.GetAllWhere((x) => x.ProjectId == project.Id);
foreach (var projectRole in projectRoles)
{
projectRoleModel.Delete(projectRole);
}
projectModel.Delete(project);
ProjectModel projectModel2 = new ProjectModel();
var project2 = projectModel2.GetById(createdSubProjectObject.Id);
ProjectRoleModel projectRoleModel2 = new ProjectRoleModel();
var projectRoles2 = projectRoleModel2.GetAllWhere((x) => x.ProjectId == project2.Id);
foreach (var projectRole in projectRoles2)
{
projectRoleModel2.Delete(projectRole);
}
projectModel2.Delete(project2);
} }
[Test] [Test]
......
...@@ -4,8 +4,10 @@ using Coscine.Api.Project.ReturnObjects; ...@@ -4,8 +4,10 @@ using Coscine.Api.Project.ReturnObjects;
using Coscine.ApiCommons.Exceptions; using Coscine.ApiCommons.Exceptions;
using Coscine.ApiCommons.Factories; using Coscine.ApiCommons.Factories;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using NUnit.Framework; using NUnit.Framework;
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
namespace Coscine.Api.Project.Tests namespace Coscine.Api.Project.Tests
...@@ -33,13 +35,13 @@ namespace Coscine.Api.Project.Tests ...@@ -33,13 +35,13 @@ namespace Coscine.Api.Project.Tests
OkObjectResult okObjectResult = (OkObjectResult)actionResult; OkObjectResult okObjectResult = (OkObjectResult)actionResult;
Assert.IsTrue(okObjectResult.Value.GetType() == typeof(ResourceObject)); Assert.IsTrue(okObjectResult.Value.GetType() == typeof(ResourceObject));
ResourceObject projectObject = (ResourceObject)okObjectResult.Value; ResourceObject resourceObject = (ResourceObject)okObjectResult.Value;
Assert.IsTrue(projectObject.Id == Resources[0].Id); Assert.IsTrue(resourceObject.Id == Resources[0].Id);
Assert.IsTrue(projectObject.ExternalId == Resources[0].