Skip to content

Commit

Permalink
Add LoadOPC and LoadVersion2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoergHoffmannatGitHub committed Feb 10, 2024
1 parent 4c56c00 commit 3db5462
Show file tree
Hide file tree
Showing 8 changed files with 3,800 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test --configuration $env:Configuration --no-build --logger GitHubActions '/p:CollectCoverage=true;CoverletOutputFormat=\"json,lcov,cobertura,opencover\";MergeWith=${{github.workspace}}/coverage.json;CoverletOutput=${{github.workspace}}/coverage' -- RunConfiguration.CollectSourceInformation=true
run: dotnet test --configuration $env:Configuration --no-build --logger GitHubActions /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura
env:
Configuration: ${{ matrix.configuration }}

Expand Down
9 changes: 9 additions & 0 deletions FamilyShowLib.Tests/FamilyShowLib.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<None Include="..\FamilyShow\Sample Files\Kennedy.ged" Link="Sample Files\Kennedy.ged">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\FamilyShow\Sample Files\Windsor.familyx" Link="Sample Files\Windsor.familyx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -43,4 +46,10 @@
<ProjectReference Include="..\FamilyShowLib\FamilyShowLib.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="Sample Files\Windsor.family">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
4 changes: 1 addition & 3 deletions FamilyShowLib.Tests/GedcomImportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ public void Import()
PeopleCollection family = [];
SourceCollection source = [];
RepositoryCollection repository = [];
string location = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)!;
string fileName = Path.Combine(location, "Sample Files", "Kennedy.ged");
bool loaded = sut.Import(family, source, repository, fileName, true);
bool loaded = sut.Import(family, source, repository, Sample.FullName("Kennedy.ged"), true);

Assert.NotNull(sut);
Assert.True(loaded);
Expand Down
41 changes: 40 additions & 1 deletion FamilyShowLib.Tests/PeopleTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
namespace FamilyShowLib.Tests;
using System.Globalization;
using System.Xml.Serialization;

namespace FamilyShowLib.Tests;

// These tests will run infinite on GitHub
public class PeopleTest
{
[Fact]
public void LoadOPC()
{
People sut = new()
{
FullyQualifiedFilename = Sample.FullName("Windsor.familyx")
};
bool loaded = sut.LoadOPC();

Assert.NotNull(sut);
Assert.True(loaded);
Assert.Equal(81, sut.PeopleCollection.Count);
Assert.Empty(sut.SourceCollection);
Assert.Empty(sut.RepositoryCollection);
}

[Fact]
public void LoadVersion2()
{
People sut = new()
{
FullyQualifiedFilename = Sample.FullName("Windsor.family")
};
bool loaded = sut.LoadVersion2();

Assert.NotNull(sut);
Assert.True(loaded);
Assert.Equal(81, sut.PeopleCollection.Count);
Assert.Empty(sut.SourceCollection);
Assert.Empty(sut.RepositoryCollection);
}
}

public class ContentChangedEventArgsTest
{
Expand Down
Loading

0 comments on commit 3db5462

Please sign in to comment.