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 Xunit;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
|
||||
var result = await service.GetAccountsAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
|
||||
var result = await service.GetAccountsAsync(TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
|
||||
var result = await service.GetAccountAsync(accountId, TestDbContextFactory.TestUserId);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
|
||||
var result = await service.GetAccountAsync(accountId, TestDbContextFactory.OtherUserId);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AccountServiceTests
|
||||
{
|
||||
using var factory = new TestDbContextFactory();
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
|
||||
var account = new Account { Name = "New", UserId = TestDbContextFactory.TestUserId, CurrencyCode = "GBP" };
|
||||
await service.CreateAccountAsync(account);
|
||||
@@ -120,7 +120,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.UpdateBalanceAsync(accountId, TestDbContextFactory.TestUserId, 250m);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -142,7 +142,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.UpdateBalanceAsync(accountId, TestDbContextFactory.OtherUserId, 999m);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -163,7 +163,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.UpdateAccountDetailsAsync(accountId, TestDbContextFactory.TestUserId, "New", "#fff", "USD");
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -187,7 +187,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.UpdateAccountDetailsAsync(accountId, TestDbContextFactory.OtherUserId, "Hacked", "#fff", "USD");
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -208,7 +208,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.DeleteAccountAsync(accountId, TestDbContextFactory.TestUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
@@ -229,7 +229,7 @@ public class AccountServiceTests
|
||||
}
|
||||
|
||||
using var context = factory.CreateContext();
|
||||
var service = new AccountService(context);
|
||||
var service = new AccountRepository(context);
|
||||
await service.DeleteAccountAsync(accountId, TestDbContextFactory.OtherUserId);
|
||||
|
||||
using var verifyCtx = factory.CreateContext();
|
||||
|
||||
Reference in new issue
Block a user