1
1
using Arian . Querium . SQL . QueryBuilders ;
2
- using Arian . Querium . SQL . Repositories ;
3
2
using Arian . Querium . SQLite . Implementations . QueryBuilders ;
4
3
using Arian . Querium . SQLite . Implementations . Repositories ;
5
4
using Microsoft . Data . Sqlite ;
6
5
using SQLitePCL ;
7
- using System . Data ;
8
6
9
7
namespace Arian . Querium . SQLite . Tests . Repositories ;
10
8
@@ -51,21 +49,21 @@ public void Dispose()
51
49
public class SqliteDynamicRepositoryTests : IAsyncLifetime
52
50
{
53
51
private readonly DatabaseFixture _fixture ;
54
- private readonly SqliteDynamicRepository _repository ;
52
+ private readonly SQliteDynamicRepository _repository ;
55
53
private const string TestTableName = "users" ;
56
54
57
55
public SqliteDynamicRepositoryTests ( DatabaseFixture fixture )
58
56
{
59
57
_fixture = fixture ;
60
- _repository = new SqliteDynamicRepository ( _fixture . ConnectionString , _fixture . QueryBuilderFactory ) ;
58
+ _repository = new SQliteDynamicRepository ( _fixture . ConnectionString , _fixture . QueryBuilderFactory ) ;
61
59
}
62
60
63
61
/// <summary>
64
62
/// Creates a test table before each test method runs.
65
63
/// </summary>
66
64
public async Task InitializeAsync ( )
67
65
{
68
- var columns = new Dictionary < string , ColumnType >
66
+ Dictionary < string , ColumnType > columns = new ( )
69
67
{
70
68
{ "Id" , ColumnType . Integer } ,
71
69
{ "Name" , ColumnType . Text } ,
@@ -87,7 +85,7 @@ public async Task DisposeAsync()
87
85
public async Task ShouldAdd_AndRetrieve_A_New_Row ( )
88
86
{
89
87
// Arrange
90
- var newUserData = new Dictionary < string , object >
88
+ Dictionary < string , object > newUserData = new ( )
91
89
{
92
90
{ "Name" , "John Doe" } ,
93
91
{ "Age" , 30 } ,
@@ -136,7 +134,7 @@ public async Task ShouldUpdate_An_Existing_Row()
136
134
Assert . NotEmpty ( allUsers ) ;
137
135
long idToUpdate = ( long ) allUsers . First ( ) [ "Id" ] ;
138
136
139
- var updatedData = new Dictionary < string , object >
137
+ Dictionary < string , object > updatedData = new ( )
140
138
{
141
139
{ "Name" , "New Name" } ,
142
140
{ "Age" , 35 }
@@ -180,7 +178,7 @@ public async Task ShouldCreate_A_Table_Successfully()
180
178
// Arrange is handled by InitializeAsync, which creates the "users" table.
181
179
// We will test creating a new, different table here.
182
180
const string newTableName = "products" ;
183
- var columns = new Dictionary < string , ColumnType >
181
+ Dictionary < string , ColumnType > columns = new ( )
184
182
{
185
183
{ "Id" , ColumnType . Integer } ,
186
184
{ "ProductName" , ColumnType . Text } ,
@@ -191,7 +189,7 @@ public async Task ShouldCreate_A_Table_Successfully()
191
189
await _repository . AddAsync ( newTableName , new Dictionary < string , object > { { "ProductName" , "Laptop" } } ) ;
192
190
193
191
// Assert
194
- var products = await _repository . GetAllAsync ( newTableName ) ;
192
+ IEnumerable < Dictionary < string , object > > products = await _repository . GetAllAsync ( newTableName ) ;
195
193
Assert . Single ( products ) ;
196
194
197
195
// Clean up the new table manually, since DisposeAsync only cleans the main one.
@@ -209,7 +207,7 @@ public async Task ShouldRename_A_Table_Successfully()
209
207
await _repository . RenameTableAsync ( TestTableName , newTableName ) ;
210
208
211
209
// Assert
212
- var renamedUsers = await _repository . GetAllAsync ( newTableName ) ;
210
+ IEnumerable < Dictionary < string , object > > renamedUsers = await _repository . GetAllAsync ( newTableName ) ;
213
211
Assert . Single ( renamedUsers ) ;
214
212
215
213
// We cannot use the old table name anymore.
@@ -249,7 +247,7 @@ public async Task ShouldReturn_Null_When_GetById_DoesNotExist()
249
247
public async Task ShouldNotUpdate_A_NonExistent_Row ( )
250
248
{
251
249
// Arrange
252
- var updatedData = new Dictionary < string , object > { { "Name" , "Updated Name" } } ;
250
+ Dictionary < string , object > updatedData = new ( ) { { "Name" , "Updated Name" } } ;
253
251
254
252
// Act
255
253
await _repository . UpdateAsync ( TestTableName , updatedData , "Id" , 999 ) ;
0 commit comments