-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,822 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: CI | ||
on: [ push, pull_request, workflow_dispatch ] | ||
env: | ||
DOTNET_NOLOGO: 1 | ||
jobs: | ||
Build: | ||
runs-on: windows-2022 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Restore cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Build | ||
run: dotnet build | ||
|
||
- name: Test | ||
run: dotnet test --no-build -v normal --logger trx | ||
|
||
- name: Publish unit test report | ||
uses: dorny/test-reporter@v1 | ||
if: success() || failure() | ||
with: | ||
name: Unit Test Report | ||
path: '**/*.trx' | ||
reporter: dotnet-trx |
5 changes: 4 additions & 1 deletion
5
...ocoQueries.PetaPoco/Directory.Build.props → Directory.Build.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
StaTypPocoQueries.PetaPoco.Tests/OverridenPropertyTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using AutoFixture.Xunit2; | ||
using FluentAssertions; | ||
using Moq; | ||
using PetaPoco; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
|
||
namespace StaTypPocoQueries.PetaPoco.Tests | ||
{ | ||
[Collection("TestsWithMappers")] | ||
public class OverridenPropertyTests | ||
{ | ||
public class Parent | ||
{ | ||
public virtual int ID { get; set; } | ||
} | ||
|
||
public class Child : Parent | ||
{ | ||
[Column("Foo")] | ||
public override int ID { get; set; } | ||
} | ||
|
||
protected Mock<IDatabase> _mockDb; | ||
protected Sql _lastSql; | ||
|
||
public OverridenPropertyTests() | ||
{ | ||
_mockDb = new Mock<IDatabase>(); | ||
_mockDb.Setup(m => m.Query<Child>(It.IsAny<Sql>())) | ||
.Returns(new List<Child>()) | ||
.Callback<Sql>(s => _lastSql = s); | ||
_mockDb.Setup(m => m.Provider).Returns(new AngleDatabaseProvider()); | ||
_mockDb.Setup(m => m.DefaultMapper).Returns(new ConventionMapper()); | ||
|
||
Mappers.RevokeAll(); | ||
} | ||
|
||
[Theory, AutoData] | ||
public void Query_Should_Use_Correct_Column_Attribute(int value) | ||
{ | ||
_mockDb.Object.Query<Child>(c => c.ID == value); | ||
_lastSql.Should().BeEquivalentTo(new Sql("WHERE <Foo> = @0", value)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
StaTypPocoQueries.PetaPoco.Tests/StaTypPocoQueries.PetaPoco.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.