Skip to content

Commit

Permalink
Merge pull request #178 from SaintAngeLs/organizations_test
Browse files Browse the repository at this point in the history
(#170) Organizations test
  • Loading branch information
SaintAngeLs authored May 26, 2024
2 parents 9fead60 + fe2c1f7 commit bf37e4d
Show file tree
Hide file tree
Showing 45 changed files with 1,125 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_microservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
test_dir: 'MiniSpace.Services.Posts/tests'
- project: 'MiniSpace.Services.Comments/src/MiniSpace.Services.Comments.Api'
test_dir: 'MiniSpace.Services.Comments/tests'
- project: 'MiniSpace.Services.Organizations/src/MiniSpace.Services.Organizations.Api'
test_dir: 'MiniSpace.Services.Organizations/tests'
- project: 'MiniSpace.Services.Posts/src/MiniSpace.Services.Posts.Api'
test_dir: 'MiniSpace.Services.Posts/tests'
- project: 'MiniSpace.Web/src/MiniSpace.Web'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Organiza
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Organizations.Infrastructure", "src\MiniSpace.Services.Organizations.Infrastructure\MiniSpace.Services.Organizations.Infrastructure.csproj", "{3C5F46E5-9CF0-4A0A-AF56-9F1D455E7D1D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{D697BE2B-E69A-40FF-9A78-0BB96CF4E6DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Organizations.Application.UnitTests", "tests\MiniSpace.Services.Organizations.Application.UnitTests\MiniSpace.Services.Organizations.Application.UnitTests.csproj", "{5CCAF099-8250-4DC6-AB75-95E35C9C91B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniSpace.Services.Organizations.Core.UnitTests", "tests\MiniSpace.Services.Organizations.Core.UnitTests\MiniSpace.Services.Organizations.Core.UnitTests.csproj", "{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -38,11 +44,21 @@ Global
{3C5F46E5-9CF0-4A0A-AF56-9F1D455E7D1D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3C5F46E5-9CF0-4A0A-AF56-9F1D455E7D1D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3C5F46E5-9CF0-4A0A-AF56-9F1D455E7D1D}.Release|Any CPU.Build.0 = Release|Any CPU
{5CCAF099-8250-4DC6-AB75-95E35C9C91B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CCAF099-8250-4DC6-AB75-95E35C9C91B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CCAF099-8250-4DC6-AB75-95E35C9C91B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CCAF099-8250-4DC6-AB75-95E35C9C91B3}.Release|Any CPU.Build.0 = Release|Any CPU
{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D8843565-EA51-407D-9F3B-BC0741B104A0} = {9A2329ED-4000-46C9-B9CD-956F6DA767CB}
{299EC532-840F-4ED9-A98F-CDC7C4DD315E} = {9A2329ED-4000-46C9-B9CD-956F6DA767CB}
{550E45D1-9BE7-4AE1-BA82-DDF57F436BEB} = {9A2329ED-4000-46C9-B9CD-956F6DA767CB}
{3C5F46E5-9CF0-4A0A-AF56-9F1D455E7D1D} = {9A2329ED-4000-46C9-B9CD-956F6DA767CB}
{5CCAF099-8250-4DC6-AB75-95E35C9C91B3} = {D697BE2B-E69A-40FF-9A78-0BB96CF4E6DA}
{FBE0DFB5-3945-4A9E-B4A0-C3BED6C74726} = {D697BE2B-E69A-40FF-9A78-0BB96CF4E6DA}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections;
using MiniSpace.Services.Organizations.Core.Entities;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.DTO
{
[ExcludeFromCodeCoverage]
public class OrganizationDetailsDto
{
public Guid Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using MiniSpace.Services.Organizations.Core.Entities;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.DTO
{
[ExcludeFromCodeCoverage]
public class OrganizationDto
{
public Guid Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]
public class GetAllChildrenOrganizations: IQuery<IEnumerable<Guid>>
{
public Guid OrganizationId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]
public class GetChildrenOrganizations: IQuery<IEnumerable<OrganizationDto>>
{
public Guid OrganizationId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]
public class GetOrganization : IQuery<OrganizationDto>
{
public Guid OrganizationId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]
public class GetOrganizationDetails : IQuery<OrganizationDetailsDto>
{
public Guid OrganizationId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;


namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]

public class GetOrganizerOrganizations: IQuery<IEnumerable<OrganizationDto>>
{

public Guid OrganizerId { get; set; }
public Guid RootId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Convey.CQRS.Queries;
using MiniSpace.Services.Organizations.Application.DTO;
using System.Diagnostics.CodeAnalysis;


namespace MiniSpace.Services.Organizations.Application.Queries
{
[ExcludeFromCodeCoverage]
public class GetRootOrganizations: IQuery<IEnumerable<OrganizationDto>>
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using MiniSpace.Services.Organizations.Application;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Contexts
{
[ExcludeFromCodeCoverage]
internal class AppContext : IAppContext
{
public string RequestId { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using MiniSpace.Services.Organizations.Application;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Contexts
{
[ExcludeFromCodeCoverage]
internal sealed class AppContextFactory : IAppContextFactory
{
private readonly ICorrelationContextAccessor _contextAccessor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Contexts
{
[ExcludeFromCodeCoverage]
internal class CorrelationContext
{
public string CorrelationId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
using MiniSpace.Services.Organizations.Application;
using System.Runtime.CompilerServices;
using System.Diagnostics.CodeAnalysis;

[assembly: InternalsVisibleTo("MiniSpace.Services.Organizations.Application.UnitTests")]

namespace MiniSpace.Services.Organizations.Infrastructure.Contexts
{
[ExcludeFromCodeCoverage]
internal class IdentityContext : IIdentityContext
{
public Guid Id { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using Convey.MessageBrokers;
using Convey.MessageBrokers.Outbox;
using Convey.Types;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Decorators
{
[Decorator]
[ExcludeFromCodeCoverage]
internal sealed class OutboxCommandHandlerDecorator<TCommand> : ICommandHandler<TCommand>
where TCommand : class, ICommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using Convey.MessageBrokers;
using Convey.MessageBrokers.Outbox;
using Convey.Types;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Decorators
{
[Decorator]
[ExcludeFromCodeCoverage]
internal sealed class OutboxEventHandlerDecorator<TEvent> : IEventHandler<TEvent>
where TEvent : class, IEvent
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
// using MiniSpace.Services.Organizations.Application.Events.External;
// using MiniSpace.Services.Organizations.Application.Exceptions;
// using MiniSpace.Services.Organizations.Core;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Exceptions
{
[ExcludeFromCodeCoverage]
internal sealed class ExceptionToMessageMapper : IExceptionToMessageMapper
{
public object Map(Exception exception, object message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using Convey.WebApi.Exceptions;
using MiniSpace.Services.Organizations.Application.Exceptions;
using MiniSpace.Services.Organizations.Core.Exceptions;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Exceptions
{
[ExcludeFromCodeCoverage]
internal sealed class ExceptionToResponseMapper : IExceptionToResponseMapper
{
private static readonly ConcurrentDictionary<Type, string> Codes = new ConcurrentDictionary<Type, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Repositories;
using MiniSpace.Services.Organizations.Infrastructure.Services;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure
{
[ExcludeFromCodeCoverage]
public static class Extensions
{
public static IConveyBuilder AddInfrastructure(this IConveyBuilder builder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using Convey.Logging.CQRS;
using Microsoft.Extensions.DependencyInjection;
using MiniSpace.Services.Organizations.Application.Commands;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Logging
{
[ExcludeFromCodeCoverage]
internal static class Extensions
{
public static IConveyBuilder AddHandlersLogging(this IConveyBuilder builder)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Convey.Logging.CQRS;
using MiniSpace.Services.Organizations.Application.Commands;
using MiniSpace.Services.Organizations.Application.Events.External;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Logging
{
[ExcludeFromCodeCoverage]
internal sealed class MessageToLogTemplateMapper : IMessageToLogTemplateMapper
{
private static IReadOnlyDictionary<Type, HandlerLogTemplate> MessageTemplates
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using MiniSpace.Services.Organizations.Application.DTO;
using MiniSpace.Services.Organizations.Core.Entities;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents
{
[ExcludeFromCodeCoverage]

public static class Extensions
{
public static Organization AsEntity(this OrganizationDocument document)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Convey.Types;
using MiniSpace.Services.Organizations.Core.Entities;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents
{
[ExcludeFromCodeCoverage]

public class OrganizationDocument: IIdentifiable<Guid>
{
public Guid Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Convey.Types;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents
{
[ExcludeFromCodeCoverage]
public class OrganizerDocument : IIdentifiable<Guid>
{
public Guid Id { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Core.Entities;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetAllChildrenOrganizationsHandler : IQueryHandler<GetAllChildrenOrganizations, IEnumerable<Guid>>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Core.Entities;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetChildrenOrganizationsHandler : IQueryHandler<GetChildrenOrganizations, IEnumerable<OrganizationDto>>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using MongoDB.Driver;
using System.Diagnostics.CodeAnalysis;


namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetOrganizationDetailsHandler : IQueryHandler<GetOrganizationDetails, OrganizationDetailsDto>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
using MiniSpace.Services.Organizations.Application.DTO;
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;


namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetOrganizationHandler : IQueryHandler<GetOrganization, OrganizationDto>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Core.Entities;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetOrganizerOrganizationsHandler : IQueryHandler<GetOrganizerOrganizations, IEnumerable<OrganizationDto>>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
using MiniSpace.Services.Organizations.Application.DTO;
using MiniSpace.Services.Organizations.Application.Queries;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Queries.Handlers
{
[ExcludeFromCodeCoverage]
public class GetRootOrganizationsHandler : IQueryHandler<GetRootOrganizations, IEnumerable<OrganizationDto>>
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
using MiniSpace.Services.Organizations.Core.Entities;
using MiniSpace.Services.Organizations.Core.Repositories;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Repositories
{
[ExcludeFromCodeCoverage]
public class OrganizationMongoRepository : IOrganizationRepository
{
private readonly IMongoRepository<OrganizationDocument, Guid> _repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
using MiniSpace.Services.Organizations.Core.Entities;
using MiniSpace.Services.Organizations.Core.Repositories;
using MiniSpace.Services.Organizations.Infrastructure.Mongo.Documents;
using System.Diagnostics.CodeAnalysis;

namespace MiniSpace.Services.Organizations.Infrastructure.Mongo.Repositories
{
[ExcludeFromCodeCoverage]
public class OrganizerMongoRepository : IOrganizerRepository
{
private readonly IMongoRepository<OrganizerDocument, Guid> _repository;
Expand Down
Loading

0 comments on commit bf37e4d

Please sign in to comment.