Skip to content

Commit

Permalink
fix(Test-AdminService): fix bugs and edit some methods in AdminServic…
Browse files Browse the repository at this point in the history
…eTests and AdminRegisterServiceTests classes.
  • Loading branch information
K-Kabiri committed Sep 2, 2024
1 parent 7efbfb5 commit dcdae01
Show file tree
Hide file tree
Showing 140 changed files with 495 additions and 501 deletions.
13 changes: 12 additions & 1 deletion AnalysisData/AnalysisData.sln.DotSettings.user
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TestId>xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.Repository.RoleRepository.RoleRepositoryTests</TestId>
</TestAncestor>
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1463d704_002D5ef5_002D4eb3_002Da61f_002D385581241cf9/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="GetUserByUsernameAsync_ShouldReturnsUserWithInputUsername_WhenUserExists" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1463d704_002D5ef5_002D4eb3_002Da61f_002D385581241cf9/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="GetUserByUsernameAsync_ShouldReturnsUserWithInputUsername_WhenUserExists" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.UserRepository.UserRepositoryTests.GetUserByEmailAsync_ShouldReturnsNull_WhenUserWithInputEmailDoesNotExist&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.UserRepository.UserRepositoryTests.GetUserByIdAsync_ShouldReturnsUserWithInputId_WhenUserWithInputIdExists&lt;/TestId&gt;&#xD;
Expand All @@ -29,6 +29,8 @@
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminServiceTests.DeleteUserAsync_ShouldReturnTrue_WhenUserExists&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::AdminServiceTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Repository.UserRepository.UserRepositoryTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminServiceTests&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1e8f93b2_002D4572_002D4c58_002Db711_002Dacb713304847/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="GetRole_ShouldReturnsRole_WhenRoleExists #3" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
Expand Down Expand Up @@ -60,6 +62,15 @@
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.Repository.UserRepository.UserRepositoryTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.Repository.RoleRepository.RoleRepositoryTests.DeleteRole_ShouldReturnsFalse_WhenRoleDoesNotExist&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=7daf18b0_002D56cf_002D4c0c_002Da004_002D0da528af25ea/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckExistenceOfRole_ShouldNotThrowException_WhenRoleExists" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminServiceTests&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests.RegisterByAdminAsync_ShouldThrowDuplicateUserException_WhenUserAlreadyExists&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests.CheckExistenceRole_ShouldThrowRoleNotFoundException_WhenRoleDoesNotExist&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests.ValidateUserInformation_ShouldThrowDuplicateUserException_WhenUserAlreadyExists&lt;/TestId&gt;&#xD;
&lt;TestId&gt;xUnit::9AEC1F3F-B1B3-47C1-82D4-E432E2D77E0E::net8.0::TestProject.User.Services.AdminService.AdminRegisterServiceTests&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8ae15fa0_002Dd719_002D4ce1_002D847c_002De586feccc67f/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="AddRole_ShouldAddsRoleToDatabase_Whenever" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
Expand Down
52 changes: 35 additions & 17 deletions AnalysisData/AnalysisData/ConfigService.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
using AnalysisData.CookieService.abstractions;
using AnalysisData.EAV.Repository;
using AnalysisData.EAV.Repository.Abstraction;
using AnalysisData.EAV.Repository.CategoryRepository;
using AnalysisData.EAV.Repository.CategoryRepository.asbtraction;
using AnalysisData.EAV.Repository.EdgeRepository;
using AnalysisData.EAV.Repository.EdgeRepository.Abstraction;
using AnalysisData.EAV.Repository.FileUploadedRepository;
using AnalysisData.EAV.Repository.NodeRepository;
using AnalysisData.EAV.Repository.NodeRepository.Abstraction;
using AnalysisData.EAV.Service;
using AnalysisData.EAV.Service.Abstraction;
using AnalysisData.EAV.Service.Business;
using AnalysisData.EAV.Service.Business.Abstraction;
using AnalysisData.EAV.Service.GraphServices.NodeAndEdgeServices;
using AnalysisData.EAV.Service.GraphServices.Relationship;
using AnalysisData.EAV.Service.GraphSevices;
using AnalysisData.Graph.Repository.CategoryRepository;
using AnalysisData.Graph.Repository.CategoryRepository.Abstraction;
using AnalysisData.Graph.Repository.EdgeRepository;
using AnalysisData.Graph.Repository.EdgeRepository.Abstraction;
using AnalysisData.Graph.Repository.FileUploadedRepository;
using AnalysisData.Graph.Repository.FileUploadedRepository.Abstraction;
using AnalysisData.Graph.Repository.GraphEdgeRepository;
using AnalysisData.Graph.Repository.GraphNodeRepository;
using AnalysisData.Graph.Repository.NodeRepository;
using AnalysisData.Graph.Repository.NodeRepository.Abstraction;
using AnalysisData.Graph.Repository.UserFileRepository;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;
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.FileUploadService;
using AnalysisData.Graph.Service.FileUploadService.Abstraction;
using AnalysisData.Graph.Service.GraphServices.AllNodesData;
using AnalysisData.Graph.Service.GraphServices.NodeAndEdgeInfo;
using AnalysisData.Graph.Service.GraphServices.Relationship;
using AnalysisData.Graph.Service.GraphServices.Search;
using AnalysisData.Graph.Service.ServiceBusiness;
using AnalysisData.Graph.Service.ServiceBusiness.Abstraction;
using AnalysisData.JwtService.abstractions;
using AnalysisData.Repository.RoleRepository;
using AnalysisData.Repository.RoleRepository.Abstraction;
using AnalysisData.Repository.UserRepository;
using AnalysisData.Repository.UserRepository.Abstraction;
using AnalysisData.Services;
using AnalysisData.Services.Abstraction;
using AnalysisData.Services.AdminService;
using AnalysisData.Services.AdminService.Abstraction;
using AnalysisData.Services.PemissionService;
using AnalysisData.Services.PemissionService.Abstraction;
using AnalysisData.Services.RoleService;
using AnalysisData.Services.RoleService.Abstraction;
using AnalysisData.Services.S3FileStorageService;
using AnalysisData.Services.S3FileStorageService.Abstraction;
using AnalysisData.Services.SecurityPasswordService;
using AnalysisData.Services.SecurityPasswordService.Abstraction;
using AnalysisData.Services.UserService;
using AnalysisData.Services.UserService.Abstraction;
using AnalysisData.Services.ValidationService;
using AnalysisData.Services.ValidationService.Abstraction;
using Microsoft.AspNetCore.Identity;

namespace AnalysisData;
Expand Down
7 changes: 5 additions & 2 deletions AnalysisData/AnalysisData/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using AnalysisData.EAV.Model;
using AnalysisData.UserManage.Model;
using AnalysisData.Graph.Model.Category;
using AnalysisData.Graph.Model.Edge;
using AnalysisData.Graph.Model.File;
using AnalysisData.Graph.Model.Node;
using AnalysisData.Model;
using Microsoft.EntityFrameworkCore;

namespace AnalysisData.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class CategoryAlreadyExist : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class CategoryResultNotFoundException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class EdgeNotFoundException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class FileExistenceException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class NoFileUploadedException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.Exception;
namespace AnalysisData.Exception.GraphException;

public class NodeNotFoundException : ServiceException
{
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 AdminExistenceException : ServiceException
{
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 DuplicateRoleExistException : ServiceException
{
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 DuplicateUserException : ServiceException
{
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 GuidNotCorrectFormat : ServiceException
{
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 InvalidEmailFormatException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace AnalysisData.Exception;

using System;
namespace AnalysisData.Exception.UserException;

public class InvalidPasswordException : ServiceException
{
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 InvalidPasswordFormatException : ServiceException
{
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 InvalidPhoneNumberFormatException : ServiceException
{
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 PasswordMismatchException : ServiceException
{
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 RoleNotFoundException : ServiceException
{
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 TokenNotFoundInCookieException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace AnalysisData.Exception;

using System;
namespace AnalysisData.Exception.UserException;

public class UserNotFoundException : ServiceException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using AnalysisData.EAV.Dto;
using AnalysisData.EAV.Service.Abstraction;
using AnalysisData.Graph.Dto.CategoryDto;
using AnalysisData.Graph.Service.CategoryService.Abstraction;
using Microsoft.AspNetCore.Mvc;

namespace AnalysisData.EAV.Controllers;
namespace AnalysisData.Graph.Controllers;

[ApiController]
[Route("api/[controller]")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using AnalysisData.EAV.Dto;
using AnalysisData.EAV.Repository.Abstraction;
using AnalysisData.EAV.Service;
using AnalysisData.Repository.UserRepository.Abstraction;
using AnalysisData.Graph.Dto;
using AnalysisData.Graph.Repository.UserFileRepository.Abstraction;
using AnalysisData.Graph.Service.FilePermissionService;
using Microsoft.AspNetCore.Mvc;

namespace AnalysisData.EAV.Controllers;
namespace AnalysisData.Graph.Controllers;

[ApiController]
[Route("api/[controller]")]
Expand Down
11 changes: 6 additions & 5 deletions AnalysisData/AnalysisData/Graph/Controllers/FileController.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Security.Claims;
using AnalysisData.EAV.Dto;
using AnalysisData.EAV.Service.Abstraction;
using AnalysisData.Exception;
using AnalysisData.Exception.GraphException;
using AnalysisData.Graph.Dto.EdgeDto;
using AnalysisData.Graph.Dto.NodeDto;
using AnalysisData.Graph.Service.FileUploadService.Abstraction;
using AnalysisData.Graph.Service.ServiceBusiness.Abstraction;
using Microsoft.AspNetCore.Mvc;

namespace AnalysisData.EAV.Controllers;
namespace AnalysisData.Graph.Controllers;

[ApiController]
[Route("api/[controller]")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using AnalysisData.Data;
using AnalysisData.EAV.Service.Abstraction;
using AnalysisData.EAV.Service.GraphServices.NodeAndEdgeServices;
using AnalysisData.EAV.Service.GraphServices.Relationship;
using AnalysisData.EAV.Service.GraphSevices;
using AnalysisData.Graph.Service.GraphServices.AllNodesData;
using AnalysisData.Graph.Service.GraphServices.NodeAndEdgeInfo;
using AnalysisData.Graph.Service.GraphServices.Relationship;
using AnalysisData.Graph.Service.GraphServices.Search;
using Microsoft.AspNetCore.Mvc;

namespace AnalysisData.EAV.Controllers;
namespace AnalysisData.Graph.Controllers;

[ApiController]
[Route("api/[controller]")]
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/AccessFileToUserDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto;

public class AccessFileToUserDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Model;
namespace AnalysisData.Graph.Dto.CategoryDto;

public class CategoryDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.CategoryDto;

public class NewCategoryDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using AnalysisData.EAV.Model;

namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.CategoryDto;

public class PaginationCategoryDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/EdgeDto/EdgeDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.EdgeDto;

public class EdgeDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.EdgeDto;

public class EdgeUploadDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/FileEntityDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto;

public class FileEntityDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.NodeDto;

public class NodeDto
{
Expand Down
3 changes: 1 addition & 2 deletions AnalysisData/AnalysisData/Graph/Dto/NodeDto/NodeUploadDto.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using AnalysisData.EAV.Model;

namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.NodeDto;

public class NodeUploadDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.NodeDto;

public class PaginatedNodeListDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto.NodeDto;

public class PaginationNodeDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/PaginatedFileDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto;

public class PaginatedFileDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Dto/UserAccessDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto;

public class UserAccessDto
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace AnalysisData.EAV.Dto;
namespace AnalysisData.Graph.Dto;

public class WhoAccessThisFileDto
{
Expand Down
2 changes: 1 addition & 1 deletion AnalysisData/AnalysisData/Graph/Model/Category/Category.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace AnalysisData.EAV.Model;
namespace AnalysisData.Graph.Model.Category;

public class Category
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace AnalysisData.EAV.Model;
namespace AnalysisData.Graph.Model.Edge;

public class AttributeEdge
{
Expand Down
Loading

0 comments on commit dcdae01

Please sign in to comment.