Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Test): fix package of test project. #91

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AnalysisData/AnalysisData/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using AnalysisData.Graph.Service.CategoryService;
using AnalysisData.Graph.Service.CategoryService.Abstraction;
using AnalysisData.Graph.Service.FilePermissionService;
using AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
using AnalysisData.Graph.Service.FilePermissionService.AccessManagement;
using AnalysisData.Graph.Service.FileUploadService;
using AnalysisData.Graph.Service.FileUploadService.Abstraction;
using AnalysisData.Graph.Service.GraphServices.AllNodesData;
Expand Down Expand Up @@ -48,6 +48,7 @@
using AnalysisData.User.Services.UserService;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.Services.ValidationService;
using AnalysisData.User.Services.ValidationService.Abstraction;
using CsvHelper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.UserException;

public class PasswordHasherInputNull : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using AnalysisData.Graph.Model.File;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;

namespace AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
namespace AnalysisData.Graph.Service.FilePermissionService.AccessManagement;

public class AccessManagementService : IAccessManagementService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
namespace AnalysisData.Graph.Service.FilePermissionService.AccessManagement;

public interface IAccessManagementService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using AnalysisData.Graph.Dto;
using AnalysisData.Graph.Repository.FileUploadedRepository.Abstraction;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;
using AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
using AnalysisData.Graph.Service.FilePermissionService.AccessManagement;
using AnalysisData.User.Repository.UserRepository.Abstraction;

namespace AnalysisData.Graph.Service.FilePermissionService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Security.Cryptography;
using System.Text;
using AnalysisData.Exception;
using AnalysisData.Exception.UserException;
using AnalysisData.User.Services.SecurityPasswordService.Abstraction;

namespace AnalysisData.User.Services.SecurityPasswordService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using AnalysisData.User.UserDto.UserDto;

namespace AnalysisData.User.Services.UserService.Abstraction;
namespace AnalysisData.User.Services.UserService.Business.Abstraction;

public interface ILoginManager
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.User.Services.UserService.Abstraction;
namespace AnalysisData.User.Services.UserService.Business.Abstraction;

public interface IPasswordManager
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace AnalysisData.User.Services.UserService.Abstraction;
namespace AnalysisData.User.Services.UserService.Business.Abstraction;

public interface IPasswordService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Security.Claims;
using AnalysisData.User.UserDto.UserDto;

namespace AnalysisData.User.Services.UserService.Abstraction;
namespace AnalysisData.User.Services.UserService.Business.Abstraction;

public interface IUserManager
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using AnalysisData.User.JwtService.abstractions;
using AnalysisData.User.Repository.UserRepository.Abstraction;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.UserDto.UserDto;

namespace AnalysisData.User.Services.UserService.Business;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

using AnalysisData.User.Services.SecurityPasswordService.Abstraction;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.Services.ValidationService.Abstraction;

namespace AnalysisData.User.Services.UserService.Business;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AnalysisData.Exception.UserException;
using AnalysisData.User.Services.SecurityPasswordService.Abstraction;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.Services.ValidationService.Abstraction;

namespace AnalysisData.User.Services.UserService.Business;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using AnalysisData.Exception.UserException;
using AnalysisData.User.Repository.UserRepository.Abstraction;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.Services.ValidationService.Abstraction;
using AnalysisData.User.UserDto.UserDto;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Security.Claims;
using AnalysisData.User.Services.UserService.Abstraction;
using AnalysisData.User.Services.UserService.Business.Abstraction;
using AnalysisData.User.UserDto.UserDto;

namespace AnalysisData.User.Services.UserService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
using AnalysisData.Graph.Dto.CategoryDto;
using AnalysisData.Graph.Model.Category;
using AnalysisData.Graph.Service.CategoryService.Abstraction;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Moq;
using Newtonsoft.Json;

namespace TestProject.mahdiTest2;
namespace TestProject.Graph.Controllers;

public class CategoryControllersTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Moq;
using Newtonsoft.Json;

namespace TestProject.mahdiTest2;
namespace TestProject.Graph.Controllers;

public class FileAccessControllersTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

using AnalysisData.Graph.Model.File;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;
using AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
using AnalysisData.Graph.Service.FilePermissionService.AccessManagement;
using Moq;

namespace TestProject.Graph.Service.FilePermissionService.AccessManagement;

public class AccessManagementServiceTest
{
private readonly Mock<IUserFileRepository> _userFileRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@

using AnalysisData.Exception.UserException;
using AnalysisData.Graph.Model.Category;
using AnalysisData.Graph.Model.File;
using AnalysisData.Graph.Repository.FileUploadedRepository.Abstraction;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;
using AnalysisData.Graph.Service.FilePermissionService;
using AnalysisData.Graph.Service.FilePermissionService.AccessMangement;
using AnalysisData.User.Model;
using AnalysisData.Graph.Service.FilePermissionService.AccessManagement;
using AnalysisData.User.Repository.UserRepository.Abstraction;
using Moq;

namespace TestProject.Graph.Service.FilePermissionService;

public class FilePermissionServiceTest
{
private readonly Mock<IFileUploadedRepository> _fileUploadedRepositoryMock;
private readonly Mock<IUserRepository> _userRepositoryMock;
private readonly Mock<IUserFileRepository> _userFileRepositoryMock;
private readonly Mock<IAccessManagementService> _accessManagementServiceMock;
private readonly FilePermissionService _sut;
private readonly AnalysisData.Graph.Service.FilePermissionService.FilePermissionService _sut;

public FilePermissionServiceTest()
{
Expand All @@ -27,12 +25,12 @@ public FilePermissionServiceTest()
_accessManagementServiceMock = new Mock<IAccessManagementService>();
_fileUploadedRepositoryMock = new Mock<IFileUploadedRepository>();

_sut = new FilePermissionService(
_sut = new AnalysisData.Graph.Service.FilePermissionService.FilePermissionService(
_fileUploadedRepositoryMock.Object,
_userRepositoryMock.Object,
_userFileRepositoryMock.Object,
_accessManagementServiceMock.Object
);
);
}

[Fact]
Expand Down Expand Up @@ -138,8 +136,8 @@ public async Task WhoAccessThisFileAsync_ShouldReturnUsers_WhenUsersExistForFile

var mockUserFiles = new List<UserFile>
{
new UserFile { User = new User { Id = userGuid1, Username = "user1" } },
new UserFile { User = new User { Id = userGuid2, Username = "user2" } }
new UserFile { User = new AnalysisData.User.Model.User { Id = userGuid1, Username = "user1" } },
new UserFile { User = new AnalysisData.User.Model.User { Id = userGuid2, Username = "user2" } }
};

_userFileRepositoryMock.Setup(repo => repo.GetByFileIdAsync(1))
Expand Down Expand Up @@ -203,7 +201,7 @@ public async Task AccessFileToUserAsync_ShouldAccessFilesToInputUsers_WhenFileAn
.Returns(Task.CompletedTask);

_userRepositoryMock.Setup(repo => repo.GetUserByIdAsync(It.IsAny<Guid>()))
.ReturnsAsync(new User());
.ReturnsAsync(new AnalysisData.User.Model.User());

// Act
await _sut.AccessFileToUserAsync(inputUserIds, fileId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
using System.Linq;
using System.Threading.Tasks;
using AnalysisData.Data;
using AnalysisData.Data;
using AnalysisData.User.Model;
using AnalysisData.User.Repository.RoleRepository;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace TestProject.User.Repository.RoleRepository;

public class RoleRepositoryTests
{
private readonly RoleRepository _sut;
private readonly AnalysisData.User.Repository.RoleRepository.RoleRepository _sut;
private readonly ServiceProvider _serviceProvider;

public RoleRepositoryTests()
Expand All @@ -23,7 +20,7 @@ public RoleRepositoryTests()
serviceCollection.AddScoped(_ => new ApplicationDbContext(options));
_serviceProvider = serviceCollection.BuildServiceProvider();

_sut = new RoleRepository(CreateDbContext());
_sut = new AnalysisData.User.Repository.RoleRepository.RoleRepository(CreateDbContext());
}

private ApplicationDbContext CreateDbContext()
Expand Down
Loading
Loading