Refactor. Add data layer
This commit is contained in:
1 parent
3b7e4e6ec5
commit
b6b794f0b4
82 files changed
+2930
-2811
No files matched your search
@@ -1,5 +1,5 @@
|
||||
using BudgetApp.Data;
|
||||
using BudgetApp.Services;
|
||||
using BudgetApp.Data.Entities;
|
||||
using BudgetApp.Data.Repositories;
|
||||
using BudgetApp.Tests.Helpers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Xunit;
|
||||
@@ -21,7 +21,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
|
||||
var result = await service.GetCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
|
||||
var result = await service.GetCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CategoryServiceTests
|
||||
{
|
||||
using var factory = new TestDbContextFactory();
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -77,13 +77,13 @@ public class CategoryServiceTests
|
||||
|
||||
using (var ctx = factory.CreateContext())
|
||||
{
|
||||
var service = new CategoryService(ctx);
|
||||
var service = new CategoryRepository(ctx);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
}
|
||||
|
||||
using (var ctx = factory.CreateContext())
|
||||
{
|
||||
var service = new CategoryService(ctx);
|
||||
var service = new CategoryRepository(ctx);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -137,7 +137,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -154,13 +154,13 @@ public class CategoryServiceTests
|
||||
|
||||
using (var ctx = factory.CreateContext())
|
||||
{
|
||||
var service = new CategoryService(ctx);
|
||||
var service = new CategoryRepository(ctx);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.TestUserId);
|
||||
}
|
||||
|
||||
using (var ctx = factory.CreateContext())
|
||||
{
|
||||
var service = new CategoryService(ctx);
|
||||
var service = new CategoryRepository(ctx);
|
||||
await service.EnsureDefaultCategoriesAsync(TestDbContextFactory.OtherUserId);
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class CategoryServiceTests
|
||||
{
|
||||
using var factory = new TestDbContextFactory();
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
|
||||
await service.CreateCategoryAsync(new Category
|
||||
{
|
||||
@@ -201,7 +201,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.UpdateCategoryAsync(categoryId, TestDbContextFactory.TestUserId, "New", "🎯");
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -224,7 +224,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.UpdateCategoryAsync(categoryId, TestDbContextFactory.OtherUserId, "Hacked", "💀");
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -245,7 +245,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.DeleteCategoryAsync(categoryId, TestDbContextFactory.TestUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -266,7 +266,7 @@ public class CategoryServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new CategoryService(context);
|
||||
var service = new CategoryRepository(context);
|
||||
await service.DeleteCategoryAsync(categoryId, TestDbContextFactory.OtherUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
|
||||
Reference in new issue
Block a user