aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs22
-rw-r--r--src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs24
2 files changed, 35 insertions, 11 deletions
diff --git a/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs b/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs
index 39868a6..a88de7f 100644
--- a/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs
+++ b/src/DevHive.Tests/DevHive.Data.Tests/UserRepositoryTests.cs
@@ -1,7 +1,29 @@
+using DevHive.Data.Repositories;
+using Microsoft.EntityFrameworkCore;
+using NUnit.Framework;
+
namespace DevHive.Data.Tests
{
+ [TestFixture]
public class UserRepositoryTests
{
+ private DevHiveContext _context;
+ private UserRepository _userRepository;
+
+ [SetUp]
+ public void Setup()
+ {
+ var options = new DbContextOptionsBuilder<DevHiveContext>()
+ .UseInMemoryDatabase("DevHive_UserRepository_Database");
+
+ this._context = new DevHiveContext(options.Options);
+ this._userRepository = new UserRepository(_context);
+ }
+
+ [Test]
+ public void Test()
+ {
+ }
}
}
diff --git a/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs b/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
index 46b2591..952ed99 100644
--- a/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
+++ b/src/DevHive.Web/Configurations/Extensions/ConfigureDependencyInjection.cs
@@ -1,5 +1,7 @@
+using DevHive.Data.Interfaces;
using DevHive.Data.Models;
using DevHive.Data.Repositories;
+using DevHive.Services.Interfaces;
using DevHive.Services.Services;
using Microsoft.Extensions.DependencyInjection;
@@ -9,17 +11,17 @@ namespace DevHive.Web.Configurations.Extensions
{
public static void DependencyInjectionConfiguration(this IServiceCollection services)
{
- services.AddTransient<LanguageRepository>();
- services.AddTransient<RoleRepository>();
- services.AddTransient<TechnologyRepository>();
- services.AddTransient<UserRepository>();
- services.AddTransient<PostRepository>();
+ services.AddScoped<ILanguageRepository, LanguageRepository>();
+ services.AddScoped<IRoleRepository, RoleRepository>();
+ services.AddScoped<ITechnologyRepository, TechnologyRepository>();
+ services.AddScoped<IUserRepository, UserRepository>();
+ services.AddScoped<IPostRepository, PostRepository>();
- services.AddTransient<LanguageService>();
- services.AddTransient<RoleService>();
- services.AddTransient<TechnologyService>();
- services.AddTransient<UserService>();
- services.AddTransient<PostService>();
+ services.AddScoped<ILanguageService, LanguageService>();
+ services.AddScoped<IRoleService, RoleService>();
+ services.AddScoped<ITechnologyService, TechnologyService>();
+ services.AddScoped<IUserService, UserService>();
+ services.AddScoped<IPostService, PostService>();
}
}
-} \ No newline at end of file
+}