Skip to content

Commit

Permalink
upgrade package dependencies + related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zmira committed Jun 7, 2024
1 parent 6fc5523 commit 0299847
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
12 changes: 6 additions & 6 deletions LiteDBAsyncTest/LiteDBAsyncTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.5.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0-preview-20220301-01" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
41 changes: 23 additions & 18 deletions LiteDBAsyncTest/SimpleRepositoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,14 @@ public async Task UpsertAsyncList()


[Fact]
public async Task<Guid> InsertAsync()
public async Task InsertAsyncAndTest()
{
var insertedPerson = await InsertAsync();

var person = new SimplePerson()
{
FirstName = "John",
LastName = "Smith"
};

await _repo.InsertAsync(person);

var resultPerson = await _repo.SingleByIdAsync<SimplePerson>(person.Id);
Assert.Equal(person.Id, resultPerson.Id);
Assert.Equal(person.FirstName, resultPerson.FirstName);
Assert.Equal(person.LastName, resultPerson.LastName);
return resultPerson.Id;
var resultPerson = await _repo.SingleByIdAsync<SimplePerson>(insertedPerson.Id);
Assert.Equal(insertedPerson.Id, resultPerson.Id);
Assert.Equal(insertedPerson.FirstName, resultPerson.FirstName);
Assert.Equal(insertedPerson.LastName, resultPerson.LastName);
}


Expand All @@ -110,8 +102,8 @@ public async Task InsertAsyncList()
public async Task UpdateAsync()
{

var id = await InsertAsync();
var person = await _repo.FirstOrDefaultAsync<SimplePerson>(x=>x.Id==id);
var insertedPerson = await InsertAsync();
var person = await _repo.FirstOrDefaultAsync<SimplePerson>(x => x.Id == insertedPerson.Id);

person.FirstName = "Hallo";
person.LastName = "Helga";
Expand Down Expand Up @@ -165,8 +157,8 @@ public async Task TestInsertingSameRecordTwiceRaisesException()
public async Task DeleteAsync()
{

var id = await InsertAsync();
var simplePerson = await _repo.SingleAsync<SimplePerson>(x=>x.Id==id);
var insertedPerson = await InsertAsync();
var simplePerson = await _repo.SingleAsync<SimplePerson>(x => x.Id == insertedPerson.Id);
bool deleteResult = await _repo.DeleteAsync<SimplePerson>(simplePerson.Id);
deleteResult.Should().BeTrue();

Expand Down Expand Up @@ -221,5 +213,18 @@ private static List<SimplePerson> GetListOflist()
};
return list;
}

private async Task<SimplePerson> InsertAsync()
{
var person = new SimplePerson()
{
FirstName = "John",
LastName = "Smith"
};

await _repo.InsertAsync(person);

return person;
}
}
}

0 comments on commit 0299847

Please sign in to comment.