diff --git a/.idea/.idea.Bahla.Backend/.idea/.gitignore b/.idea/.idea.Bahla.Backend/.idea/.gitignore
new file mode 100644
index 0000000..d0a4411
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/projectSettingsUpdater.xml
+/.idea.Bahla.Backend.iml
+/contentModel.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.idea.Bahla.Backend/.idea/.name b/.idea/.idea.Bahla.Backend/.idea/.name
new file mode 100644
index 0000000..b5e39df
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/.name
@@ -0,0 +1 @@
+Bahla.Backend
\ No newline at end of file
diff --git a/.idea/.idea.Bahla.Backend/.idea/encodings.xml b/.idea/.idea.Bahla.Backend/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Bahla.Backend/.idea/indexLayout.xml b/.idea/.idea.Bahla.Backend/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Bahla.Backend/.idea/inspectionProfiles/Project_Default.xml b/.idea/.idea.Bahla.Backend/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..679b624
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.Bahla.Backend/.idea/vcs.xml b/.idea/.idea.Bahla.Backend/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/.idea.Bahla.Backend/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Bahla.Backend.slnx b/Bahla.Backend.slnx
new file mode 100644
index 0000000..4c5dcd2
--- /dev/null
+++ b/Bahla.Backend.slnx
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/src/Bahla.API/Bahla.API.csproj b/src/Bahla.API/Bahla.API.csproj
new file mode 100644
index 0000000..f5e7949
--- /dev/null
+++ b/src/Bahla.API/Bahla.API.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/src/Bahla.API/Program.cs b/src/Bahla.API/Program.cs
new file mode 100644
index 0000000..1959671
--- /dev/null
+++ b/src/Bahla.API/Program.cs
@@ -0,0 +1,9 @@
+var builder = WebApplication.CreateBuilder(args);
+builder.Services.AddProblemDetails();
+builder.Services.AddOpenApi();
+
+
+var app = builder.Build();
+
+
+app.MapGet("/helloWorld", () => "Hello, World!");
\ No newline at end of file
diff --git a/src/Bahla.API/Properties/launchSettings.json b/src/Bahla.API/Properties/launchSettings.json
new file mode 100644
index 0000000..bef72ae
--- /dev/null
+++ b/src/Bahla.API/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "profiles": {
+ "Bahla.API": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:63146;http://localhost:63147"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Bahla.Domain/Bahla.Domain.csproj b/src/Bahla.Domain/Bahla.Domain.csproj
index fa71b7a..b760144 100644
--- a/src/Bahla.Domain/Bahla.Domain.csproj
+++ b/src/Bahla.Domain/Bahla.Domain.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
enable
enable
diff --git a/src/Bahla.Domain/Builders/Base/IEntityBuilder.cs b/src/Bahla.Domain/Builders/Base/IEntityBuilder.cs
index d0ee200..855f528 100644
--- a/src/Bahla.Domain/Builders/Base/IEntityBuilder.cs
+++ b/src/Bahla.Domain/Builders/Base/IEntityBuilder.cs
@@ -1,13 +1,12 @@
using Bahla.Domain.Entities.Base;
-namespace Bahla.Domain.Builders.Base
+namespace Bahla.Domain.Builders.Base;
+
+public interface IEntityBuilder where T : IEntity
{
- public interface IEntityBuilder where T : IEntity
- {
- ///
- /// Build the entity.
- ///
- /// Entity
- T Build();
- }
+ ///
+ /// Build the entity.
+ ///
+ /// Entity
+ T Build();
}
diff --git a/src/Bahla.Domain/Builders/Base/IRoleBuilder.cs b/src/Bahla.Domain/Builders/Base/IRoleBuilder.cs
index 13a40bd..64b54cf 100644
--- a/src/Bahla.Domain/Builders/Base/IRoleBuilder.cs
+++ b/src/Bahla.Domain/Builders/Base/IRoleBuilder.cs
@@ -1,37 +1,36 @@
using Bahla.Domain.Entities;
using Bahla.Domain.Types;
-namespace Bahla.Domain.Builders.Base
+namespace Bahla.Domain.Builders.Base;
+
+public interface IRoleBuilder : IEntityBuilder
{
- public interface IRoleBuilder : IEntityBuilder
- {
- ///
- /// Defines the identifier for the role, if not provided, a new identifier will be generated.
- ///
- /// Identifier
- /// Builder
- IRoleBuilder WithIdentifier(Identifier identifier);
+ ///
+ /// Defines the identifier for the role, if not provided, a new identifier will be generated.
+ ///
+ /// Identifier
+ /// Builder
+ IRoleBuilder WithIdentifier(Identifier identifier);
- ///
- /// Defines the name for the role.
- ///
- /// Role name
- /// Builder
- IRoleBuilder WithName(string roleName);
+ ///
+ /// Defines the name for the role.
+ ///
+ /// Role name
+ /// Builder
+ IRoleBuilder WithName(string roleName);
- ///
- /// Defines the value mask for the role. Maximum allowed is 32 bits (1 << 32).
- ///
- /// Role bitmask
- /// Builder
- IRoleBuilder WithValueMask(uint valueMask);
+ ///
+ /// Defines the value mask for the role. Maximum allowed is 32 bits (1 << 32).
+ ///
+ /// Role bitmask
+ /// Builder
+ IRoleBuilder WithValueMask(uint valueMask);
- ///
- /// Clones the role.
- ///
- /// Role
- /// Builder
- IRoleBuilder Clone(Role role);
- }
+ ///
+ /// Clones the role.
+ ///
+ /// Role
+ /// Builder
+ IRoleBuilder Clone(Role role);
}
diff --git a/src/Bahla.Domain/Builders/Base/IUserBuilder.cs b/src/Bahla.Domain/Builders/Base/IUserBuilder.cs
new file mode 100644
index 0000000..5ba77fd
--- /dev/null
+++ b/src/Bahla.Domain/Builders/Base/IUserBuilder.cs
@@ -0,0 +1,25 @@
+using Bahla.Domain.Entities;
+using Bahla.Domain.Enums;
+
+namespace Bahla.Domain.Builders.Base;
+
+public interface IUserBuilder : IEntityBuilder
+{
+ IUserBuilder WithEmail(string email);
+
+ IUserBuilder WithFirstname(string firstname);
+
+ IUserBuilder WithLastname(string lastname);
+
+ IUserBuilder WithRole(Role role);
+
+ IUserBuilder WithGender(Gender gender);
+
+ IUserBuilder WithBirthday(DateTime birthday);
+
+ IUserBuilder WithJoinedOn(DateTime joinedOn);
+
+ IUserBuilder WithSalt(IReadOnlyCollection salt);
+
+ IUserBuilder WithVerifier(IReadOnlyCollection verifier);
+}
\ No newline at end of file
diff --git a/src/Bahla.Domain/Builders/UserBuilder.cs b/src/Bahla.Domain/Builders/UserBuilder.cs
new file mode 100644
index 0000000..d19ce1c
--- /dev/null
+++ b/src/Bahla.Domain/Builders/UserBuilder.cs
@@ -0,0 +1,70 @@
+using Bahla.Domain.Builders.Base;
+using Bahla.Domain.Entities;
+using Bahla.Domain.Enums;
+using Bahla.Domain.Types;
+
+namespace Bahla.Domain.Builders;
+
+public sealed class UserBuilder : IUserBuilder
+{
+ internal Identifier _identifier;
+ internal string _email;
+ internal string _firstname;
+ internal string _lastname;
+ internal Role _role;
+ internal Gender _gender;
+ internal DateTime _birthday;
+ internal DateTime _joinedDate;
+ internal IReadOnlyCollection _salt;
+ internal IReadOnlyCollection _verifier;
+
+ public User Build()
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithEmail(string email)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithFirstname(string firstname)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithLastname(string lastname)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithRole(Role role)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithGender(Gender gender)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithBirthday(DateTime birthday)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithJoinedOn(DateTime joinedOn)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithSalt(IReadOnlyCollection salt)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IUserBuilder WithVerifier(IReadOnlyCollection verifier)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/src/Bahla.Domain/Entities/Role.cs b/src/Bahla.Domain/Entities/Role.cs
index 62c60af..6ed0df0 100644
--- a/src/Bahla.Domain/Entities/Role.cs
+++ b/src/Bahla.Domain/Entities/Role.cs
@@ -9,7 +9,7 @@ namespace Bahla.Domain.Entities
{
public string RoleName { get; init; }
public uint ValueMask { get; init; }
- internal Role(Identifier identifier, string roleName, uint valueMask) : base(identifier)
+ private Role(Identifier identifier, string roleName, uint valueMask) : base(identifier)
{
RoleName = roleName;
ValueMask = valueMask;
diff --git a/src/Bahla.Domain/Entities/User.cs b/src/Bahla.Domain/Entities/User.cs
new file mode 100644
index 0000000..9a1c5ba
--- /dev/null
+++ b/src/Bahla.Domain/Entities/User.cs
@@ -0,0 +1,52 @@
+using Bahla.Domain.Builders;
+using Bahla.Domain.Builders.Base;
+using Bahla.Domain.Enums;
+using Bahla.Domain.Types;
+using Bahla.Domain.Entities.Base;
+
+namespace Bahla.Domain.Entities;
+
+public sealed record User : Entity
+{
+ public string Email { get; init; }
+ public string Firstname { get; init; }
+ public string Lastname { get; init; }
+ public Role Role { get; init; }
+ public Gender Gender { get; init; }
+ public DateTime Birthday { get; init; }
+ public DateTime JoinedAt { get; init; }
+ public IReadOnlyCollection Salt { get; init; }
+ public IReadOnlyCollection Verifier { get; init; }
+
+ private User(Identifier identifier, string email, string firstname, string lastname, Role role, Gender gender, DateTime birthday, DateTime joinedAt, IReadOnlyCollection salt, IReadOnlyCollection verifier) : base(identifier)
+ {
+ Email = email;
+ Firstname = firstname;
+ Lastname = lastname;
+ Role = role;
+ Gender = gender;
+ Birthday = birthday;
+ JoinedAt = joinedAt;
+ Salt = salt;
+ Verifier = verifier;
+ }
+
+ internal User(UserBuilder builder) : base(builder._identifier)
+ {
+ Email = builder._email;
+ Firstname = builder._firstname;
+ Lastname = builder._lastname;
+ Role = builder._role;
+ Gender = builder._gender;
+ Birthday = builder._birthday;
+ JoinedAt = builder._joinedDate;
+ Salt = builder._salt;
+ Verifier = builder._verifier;
+ }
+
+ ///
+ /// Returns the builder
+ ///
+ public static IUserBuilder Builder => new UserBuilder();
+
+}
\ No newline at end of file
diff --git a/src/Bahla.Domain/Enums/Gender.cs b/src/Bahla.Domain/Enums/Gender.cs
new file mode 100644
index 0000000..18d1342
--- /dev/null
+++ b/src/Bahla.Domain/Enums/Gender.cs
@@ -0,0 +1,2 @@
+namespace Bahla.Domain.Enums;
+public enum Gender { Male, Female, }
\ No newline at end of file
diff --git a/src/Bahla.Domain/Specifications/AndNotSpecification.cs b/src/Bahla.Domain/Specifications/AndNotSpecification.cs
index 35f3f5b..259a826 100644
--- a/src/Bahla.Domain/Specifications/AndNotSpecification.cs
+++ b/src/Bahla.Domain/Specifications/AndNotSpecification.cs
@@ -3,10 +3,10 @@ using Bahla.Domain.Specifications.Base;
namespace Bahla.Domain.Specifications
{
- public sealed class AndNotSpecification(IEntitySpecification left, IEntitySpecification right) : CompositeSpecification where T : IEntity
+ public sealed class AndNotSpecification(ISpecification left, ISpecification right) : CompositeSpecification where T : class
{
- private readonly IEntitySpecification _left = left;
- private readonly IEntitySpecification _right = right;
+ private readonly ISpecification _left = left;
+ private readonly ISpecification _right = right;
public override bool IsSatisfiedBy(T entity)
=> _left.IsSatisfiedBy(entity) && !_right.IsSatisfiedBy(entity);
diff --git a/src/Bahla.Domain/Specifications/AndSpecification.cs b/src/Bahla.Domain/Specifications/AndSpecification.cs
index 876b408..c89fee2 100644
--- a/src/Bahla.Domain/Specifications/AndSpecification.cs
+++ b/src/Bahla.Domain/Specifications/AndSpecification.cs
@@ -1,13 +1,11 @@
-using Bahla.Domain.Entities.Base;
-using Bahla.Domain.Specifications.Base;
+using Bahla.Domain.Specifications.Base;
-namespace Bahla.Domain.Specifications
+namespace Bahla.Domain.Specifications;
+
+public sealed class AndSpecification(ISpecification left, ISpecification right) : CompositeSpecification where T : class
{
- public sealed class AndSpecification(IEntitySpecification left, IEntitySpecification right) : CompositeSpecification where T : IEntity
- {
- private readonly IEntitySpecification _left = left;
- private readonly IEntitySpecification _right = right;
- public override bool IsSatisfiedBy(T entity)
- => _left.IsSatisfiedBy(entity) && _right.IsSatisfiedBy(entity);
- }
+ private readonly ISpecification _left = left;
+ private readonly ISpecification _right = right;
+ public override bool IsSatisfiedBy(T entity)
+ => _left.IsSatisfiedBy(entity) && _right.IsSatisfiedBy(entity);
}
diff --git a/src/Bahla.Domain/Specifications/Base/CompositeSpecification.cs b/src/Bahla.Domain/Specifications/Base/CompositeSpecification.cs
index 2f0f852..d9a8651 100644
--- a/src/Bahla.Domain/Specifications/Base/CompositeSpecification.cs
+++ b/src/Bahla.Domain/Specifications/Base/CompositeSpecification.cs
@@ -1,24 +1,17 @@
-using Bahla.Domain.Entities.Base;
-using Bahla.Domain.Specifications.Base;
-
-namespace Bahla.Domain.Specifications
+namespace Bahla.Domain.Specifications.Base
{
- public abstract class CompositeSpecification : IEntitySpecification where T : IEntity
+ public abstract class CompositeSpecification : ISpecification where T : class
{
public abstract bool IsSatisfiedBy(T entity);
-
- public IEntitySpecification And(IEntitySpecification specification)
- => new AndSpecification(this, specification);
-
- public IEntitySpecification AndNot(IEntitySpecification specification)
- => new AndNotSpecification(this, specification);
- public IEntitySpecification Not()
- => new NotSpecification(this);
-
- public IEntitySpecification Or(IEntitySpecification specification)
- => new OrSpecification(this, specification);
-
- IEntitySpecification OrNot(IEntitySpecification specification)
- => new OrNotSpecification(this, specification);
+ public ISpecification And(ISpecification specification)
+ => new AndSpecification(this, specification);
+ public ISpecification AndNot(ISpecification specification)
+ => new AndNotSpecification(this, specification);
+ public ISpecification Not()
+ => new NotSpecification(this);
+ public ISpecification Or(ISpecification specification)
+ => new OrSpecification(this, specification);
+ public ISpecification OrNot(ISpecification specification)
+ => new OrNotSpecification(this, specification);
}
}
diff --git a/src/Bahla.Domain/Specifications/Base/IEntitySpecification.cs b/src/Bahla.Domain/Specifications/Base/IEntitySpecification.cs
deleted file mode 100644
index 54e3a2f..0000000
--- a/src/Bahla.Domain/Specifications/Base/IEntitySpecification.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using Bahla.Domain.Entities.Base;
-
-namespace Bahla.Domain.Specifications.Base
-{
- public interface IEntitySpecification where T : IEntity
- {
- bool IsSatisfiedBy(T entity);
- IEntitySpecification And(IEntitySpecification other);
- IEntitySpecification AndNot(IEntitySpecification other);
- IEntitySpecification Or(IEntitySpecification other);
- IEntitySpecification OrNot(IEntitySpecification other);
- IEntitySpecification Not();
-
- }
-}
diff --git a/src/Bahla.Domain/Specifications/Base/ISpecification.cs b/src/Bahla.Domain/Specifications/Base/ISpecification.cs
new file mode 100644
index 0000000..1a672f0
--- /dev/null
+++ b/src/Bahla.Domain/Specifications/Base/ISpecification.cs
@@ -0,0 +1,15 @@
+using Bahla.Domain.Entities.Base;
+
+namespace Bahla.Domain.Specifications.Base
+{
+ public interface ISpecification where T : class
+ {
+ bool IsSatisfiedBy(T entity);
+ ISpecification And(ISpecification other);
+ ISpecification AndNot(ISpecification other);
+ ISpecification Or(ISpecification other);
+ ISpecification OrNot(ISpecification other);
+ ISpecification Not();
+
+ }
+}
diff --git a/src/Bahla.Domain/Specifications/NotSpecification.cs b/src/Bahla.Domain/Specifications/NotSpecification.cs
index 5e9473a..fbf4390 100644
--- a/src/Bahla.Domain/Specifications/NotSpecification.cs
+++ b/src/Bahla.Domain/Specifications/NotSpecification.cs
@@ -1,12 +1,11 @@
using Bahla.Domain.Entities.Base;
using Bahla.Domain.Specifications.Base;
-namespace Bahla.Domain.Specifications
+namespace Bahla.Domain.Specifications;
+
+public sealed class NotSpecification(ISpecification other) : CompositeSpecification where T : class
{
- public sealed class NotSpecification(IEntitySpecification other) : CompositeSpecification where T : IEntity
- {
- private readonly IEntitySpecification _other = other;
- public override bool IsSatisfiedBy(T entity)
- => !_other.IsSatisfiedBy(entity);
- }
+ private readonly ISpecification _other = other;
+ public override bool IsSatisfiedBy(T entity)
+ => !_other.IsSatisfiedBy(entity);
}
diff --git a/src/Bahla.Domain/Specifications/OrNotSpecification.cs b/src/Bahla.Domain/Specifications/OrNotSpecification.cs
index 1977a80..51dc635 100644
--- a/src/Bahla.Domain/Specifications/OrNotSpecification.cs
+++ b/src/Bahla.Domain/Specifications/OrNotSpecification.cs
@@ -1,14 +1,13 @@
using Bahla.Domain.Entities.Base;
using Bahla.Domain.Specifications.Base;
-namespace Bahla.Domain.Specifications
-{
- public sealed class OrNotSpecification(IEntitySpecification left, IEntitySpecification right) : CompositeSpecification where T : IEntity
- {
- private readonly IEntitySpecification _left = left;
- private readonly IEntitySpecification _right = right;
+namespace Bahla.Domain.Specifications;
- public override bool IsSatisfiedBy(T entity)
- => _left.IsSatisfiedBy(entity) || !_right.IsSatisfiedBy(entity);
- }
+public sealed class OrNotSpecification(ISpecification left, ISpecification right) : CompositeSpecification where T : class
+{
+ private readonly ISpecification _left = left;
+ private readonly ISpecification _right = right;
+
+ public override bool IsSatisfiedBy(T entity)
+ => _left.IsSatisfiedBy(entity) || !_right.IsSatisfiedBy(entity);
}
diff --git a/src/Bahla.Domain/Specifications/OrSpecification.cs b/src/Bahla.Domain/Specifications/OrSpecification.cs
index 1f06fee..21d6edc 100644
--- a/src/Bahla.Domain/Specifications/OrSpecification.cs
+++ b/src/Bahla.Domain/Specifications/OrSpecification.cs
@@ -1,14 +1,13 @@
using Bahla.Domain.Entities.Base;
using Bahla.Domain.Specifications.Base;
-namespace Bahla.Domain.Specifications
-{
- public sealed class OrSpecification(IEntitySpecification left, IEntitySpecification right) : CompositeSpecification where T : IEntity
- {
- private readonly IEntitySpecification _left = left;
- private readonly IEntitySpecification _right = right;
+namespace Bahla.Domain.Specifications;
- public override bool IsSatisfiedBy(T entity)
- => _left.IsSatisfiedBy(entity) || _right.IsSatisfiedBy(entity);
- }
+public sealed class OrSpecification(ISpecification left, ISpecification right) : CompositeSpecification where T : class
+{
+ private readonly ISpecification _left = left;
+ private readonly ISpecification _right = right;
+
+ public override bool IsSatisfiedBy(T entity)
+ => _left.IsSatisfiedBy(entity) || _right.IsSatisfiedBy(entity);
}
diff --git a/src/Bahla.Persistence/Bahla.Persistence.csproj b/src/Bahla.Persistence/Bahla.Persistence.csproj
index 675a71d..fb5f971 100644
--- a/src/Bahla.Persistence/Bahla.Persistence.csproj
+++ b/src/Bahla.Persistence/Bahla.Persistence.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
enable
enable
diff --git a/src/Bahla.Persistence/Class1.cs b/src/Bahla.Persistence/Class1.cs
deleted file mode 100644
index 5728cf0..0000000
--- a/src/Bahla.Persistence/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Bahla.Persistence
-{
- public class Class1
- {
-
- }
-}
diff --git a/src/Bahla.Tests/Bahla.Tests.csproj b/src/Bahla.Tests/Bahla.Tests.csproj
index d190730..e6e3f77 100644
--- a/src/Bahla.Tests/Bahla.Tests.csproj
+++ b/src/Bahla.Tests/Bahla.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
enable
enable
diff --git a/src/Bahla.Tests/Builders/BuilderTests.cs b/src/Bahla.Tests/Builders/BuilderTests.cs
deleted file mode 100644
index 225ce22..0000000
--- a/src/Bahla.Tests/Builders/BuilderTests.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Bahla.Domain.Entities;
-using Bahla.Domain.Exceptions;
-
-namespace Bahla.Tests.Builders
-{
- internal class BuilderTests
- {
-
- [Test, Description("Test to create a role through builder.")]
- public void TestRoleBuilder()
- {
- var role = Role.Builder
- .WithName("Administrator")
- .WithValueMask(1 << 0)
- .Build();
-
- var clonedRole = Role.Builder
- .Clone(role)
- .Build();
-
- Assert.Multiple(() =>
- {
- Assert.That(role.RoleName, Is.EqualTo(clonedRole.RoleName));
- Assert.That(role.ValueMask, Is.EqualTo(clonedRole.ValueMask));
- Assert.That(role.UUID, Is.EqualTo(clonedRole.UUID));
-
- Assert.That(clonedRole, Is.Not.SameAs(role));
- });
- }
-
- [Test, Description("Test to create a role with a empty or null name.")]
- public void TestRoleBuilderBadName()
- {
- Assert.Throws(() =>
- {
- Role.Builder
- .WithName("")
- .WithValueMask(1 << 0)
- .Build();
-
- });
- }
- }
-}
diff --git a/src/Bahla.Tests/Builders/RoleBuilderTest.cs b/src/Bahla.Tests/Builders/RoleBuilderTest.cs
new file mode 100644
index 0000000..9876cb0
--- /dev/null
+++ b/src/Bahla.Tests/Builders/RoleBuilderTest.cs
@@ -0,0 +1,72 @@
+using Bahla.Domain.Entities;
+using Bahla.Domain.Exceptions;
+
+namespace Bahla.Tests.Builders
+{
+ internal class RoleBuilderTest
+ {
+ private const string R1Name = "Organisateur";
+ private const int R1ValueMask = 1 << 0;
+
+ private const string R2Name = "Animateur";
+ private const int R2ValueMask = 1 << 1;
+
+ private const string R3Name = "Bahla Bot";
+ private const int R3ValueMask = 1 << 2;
+
+ private const string R4Name = "Utilisateur";
+ private const int R4ValueMask = 1 << 3;
+
+
+ [Test, Description("Create 4 roles through builder and check if they're well created")]
+ public void TestRoleBuilder()
+ {
+ var r1 = Role.Builder
+ .WithName(R1Name)
+ .WithValueMask(R1ValueMask)
+ .Build();
+
+ var r2 = Role.Builder
+ .WithName(R2Name)
+ .WithValueMask(R2ValueMask)
+ .Build();
+
+ var r3 = Role.Builder
+ .WithName(R3Name)
+ .WithValueMask(R3ValueMask)
+ .Build();
+
+ var r4 = Role.Builder
+ .WithName(R4Name)
+ .WithValueMask(R4ValueMask)
+ .Build();
+
+ Assert.Multiple(() =>
+ {
+ Assert.That(r1.RoleName, Is.EqualTo(R1Name));
+ Assert.That(r1.ValueMask, Is.EqualTo(R1ValueMask));
+
+ Assert.That(r2.RoleName, Is.EqualTo(R2Name));
+ Assert.That(r2.ValueMask, Is.EqualTo(R2ValueMask));
+
+ Assert.That(r3.RoleName, Is.EqualTo(R3Name));
+ Assert.That(r3.ValueMask, Is.EqualTo(R3ValueMask));
+
+ Assert.That(r4.RoleName, Is.EqualTo(R4Name));
+ Assert.That(r4.ValueMask, Is.EqualTo(R4ValueMask));
+ });
+
+ }
+
+
+ [Test, Description("Create a role with an empty name and check if the builder throws a specification exception")]
+ public void TestRoleBuilderSpecification()
+ {
+ Assert.Throws(() =>
+ {
+ var r1 = Role.Builder
+ .Build();
+ });
+ }
+ }
+}
diff --git a/src/Bahla.Tests/TestDataProvider.cs b/src/Bahla.Tests/TestDataProvider.cs
new file mode 100644
index 0000000..0fc5604
--- /dev/null
+++ b/src/Bahla.Tests/TestDataProvider.cs
@@ -0,0 +1,94 @@
+using System.Runtime.InteropServices.JavaScript;
+using Bahla.Domain.Builders;
+using Bahla.Domain.Entities;
+using Bahla.Domain.Enums;
+using Bahla.Domain.Types;
+
+namespace Bahla.Tests;
+
+public class TestDataProvider
+{
+ public static readonly Identifier U1 = "d627dfe8-7896-483e-a78d-d5b5832a5543";
+ public static readonly Identifier U2 = "0d665df1-056d-4038-9d57-5999cb2bf72f";
+ public static readonly Identifier U3 = "066f7e1a-42ca-4139-9b2e-a6faeb880738";
+ public static readonly Identifier U4 = "081b9fe4-6c84-449b-9bdd-08c23b4b5e78";
+
+ public static Dictionary Users = new()
+ {
+ {
+ U1,
+ User.Builder
+ .WithEmail("john.doe@mail.com")
+ .WithFirstname("John")
+ .WithLastname("Doe")
+ .WithRole(Role.Builder
+ .WithName("Animateur/Animatrice")
+ .WithValueMask(1 << 1)
+ .Build())
+ .WithGender(Gender.Male)
+ .WithBirthday(new DateTime(1990, 1, 1))
+ .WithJoinedOn(DateTime.Now
+ .AddDays(5))
+ .WithSalt([0x1, 0x2, 0x3, 0x4])
+ .WithVerifier([0x5, 0x6, 0x7, 0x8])
+ .Build()
+ },
+
+ {
+ U2,
+ User.Builder
+ .WithEmail("jane.doe@mail.com")
+ .WithFirstname("Jane")
+ .WithLastname("Doe")
+ .WithRole(Role.Builder
+ .WithName("Organisateur/Organisatrice")
+ .WithValueMask(1 << 2)
+ .Build())
+ .WithGender(Gender.Female)
+ .WithBirthday(new DateTime(1994, 3, 28))
+ .WithJoinedOn(DateTime.Now
+ .AddDays(10))
+ .WithSalt([0x10, 0x30, 0x40, 0x50])
+ .WithVerifier([0xA, 0xB, 0xC, 0xD])
+ .Build()
+ },
+
+ {
+ U3,
+ User.Builder
+ .WithEmail("alice.bob@mail.com")
+ .WithFirstname("Alice")
+ .WithLastname("Bob")
+ .WithRole(Role.Builder
+ .WithName("Usager/Usagère")
+ .WithValueMask(1 << 0)
+ .Build())
+ .WithGender(Gender.Female)
+ .WithBirthday(new DateTime(1998, 14, 04))
+ .WithJoinedOn(DateTime.Now
+ .AddMonths(2))
+ .WithSalt([0xB, 0xE, 0xE, 0xF])
+ .WithVerifier([0xC, 0xA, 0xF, 0xE, 0xE])
+ .Build()
+ },
+
+ {
+ U4,
+ User.Builder
+ .WithEmail("max.dupont@mail.com")
+ .WithFirstname("Max")
+ .WithLastname("Dupont")
+ .WithGender(Gender.Male)
+ .WithRole(Role.Builder
+ .WithName("Usager/Usagère")
+ .WithValueMask(1 << 0)
+ .Build())
+ .WithBirthday(new DateTime(1999, 12, 31))
+ .WithJoinedOn(DateTime.Now
+ .AddYears(2))
+ .WithSalt([0xF, 0xF])
+ .WithVerifier([0xE, 0xA, 0xF, 0xD])
+ .Build()
+ }
+ };
+}
\ No newline at end of file
diff --git a/src/Bahla.Tests/Types/TypeIdentifierTests.cs b/src/Bahla.Tests/Types/TypeIdentifierTests.cs
index 2099bf1..41cb066 100644
--- a/src/Bahla.Tests/Types/TypeIdentifierTests.cs
+++ b/src/Bahla.Tests/Types/TypeIdentifierTests.cs
@@ -1,6 +1,6 @@
using Bahla.Domain.Types;
-namespace Bahla.Tests.Entities
+namespace Bahla.Tests.Types
{
internal class TypeIdentifierTests
{