Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="NHibernate" Version="$(NHibernatePackageVersion)" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.106.0" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
2 changes: 1 addition & 1 deletion src/Examples.FirstProject/Examples.FirstProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="NHibernate" Version="$(NHibernatePackageVersion)" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.106.0" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.113.1" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
12 changes: 6 additions & 6 deletions src/FluentNHibernate.Specs/FluentNHibernate.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.3" />
<PackageReference Include="FluentAssertions" Version="4.19.4" />
<PackageReference Include="Machine.Specifications" Version="0.12.0" />
<PackageReference Include="Machine.Specifications.Runner.Console" Version="0.9.3" />
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.6.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Machine.Specifications" Version="1.0.0" />
<PackageReference Include="Machine.Specifications.Runner.Console" Version="1.0.0" />
<PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.10.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public void AddingSingleShouldntThrowIfHasParameterlessConstructor()
{
Action act = () => finder.Add<ConventionWithParameterlessConstructor>();

act.ShouldNotThrow();
act.Should().NotThrow();
}

[Test]
public void AddingSingleShouldntThrowIfHasIConventionFinderConstructor()
{
Action act = () => finder.Add<ConventionWithIConventionFinderConstructor>();

act.ShouldNotThrow();
act.Should().NotThrow();

}

Expand All @@ -39,23 +39,23 @@ public void AddingSingleShouldThrowIfNoParameterlessConstructor()
{
Action act = () => finder.Add<ConventionWithoutValidConstructor>();

act.ShouldThrow<MissingConstructorException>();
act.Should().Throw<MissingConstructorException>();
}

[Test]
public void AddingSingleShouldThrowIfNoIConventionFinderConstructor()
{
Action act = () => finder.Add<ConventionWithoutValidConstructor>();

act.ShouldThrow<MissingConstructorException>();
act.Should().Throw<MissingConstructorException>();
}

[Test]
public void AddingAssemblyShouldntThrowIfNoIConventionFinderConstructor()
{
Action act = () => finder.AddAssembly(typeof(ConventionWithoutValidConstructor).Assembly);

act.ShouldNotThrow();
act.Should().NotThrow();
}
}

Expand Down
15 changes: 8 additions & 7 deletions src/FluentNHibernate.Testing/FluentNHibernate.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.0" />
<PackageReference Include="FakeItEasy" Version="4.3.0" />
<PackageReference Include="FluentAssertions" Version="4.19.4" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.108" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="FakeItEasy" Version="6.2.1" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.113.1" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void ShouldThrowExceptionWhenResolvingUnregisteredType()
{
Action act = () => container.Resolve<IExample>();

act.ShouldThrow<ResolveException>()
act.Should().Throw<ResolveException>()
.WithMessage("Unable to resolve dependency: '" + typeof(IExample).FullName + "'");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void Setup()
var transaction = A.Fake<ITransaction>();
var session = A.Fake<ISession>();
A.CallTo(() => session.BeginTransaction()).Returns(transaction);

A.CallTo(() => session.Transaction).Returns(transaction);
sessionSource = A.Fake<ISessionSource>();
A.CallTo(() => sessionSource.CreateSession()).Returns(session);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ public void Should_Not_Open_A_New_Transaction_If_One_Is_Passed()
A.CallTo(() => transaction.IsActive).Returns(true);

var session = A.Fake<ISession>();
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).Returns(transaction);
#pragma warning restore CS0618 // Type or member is obsolete

var spec = new PersistenceSpecification<Cat>(session);
spec.VerifyTheMappings();

A.CallTo(() => session.BeginTransaction()).MustNotHaveHappened();
A.CallTo(() => session.Transaction).MustHaveHappened(Repeated.Exactly.Twice);
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).MustHaveHappened(1, Times.Exactly);
#pragma warning restore CS0618 // Type or member is obsolete
}

[Test]
Expand All @@ -46,13 +50,17 @@ public void Should_Open_A_New_Transaction_If_None_Is_Passed()
A.CallTo(() => transaction.IsActive).Returns(false);

var session = A.Fake<ISession>();
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).Returns(transaction);
#pragma warning restore CS0618 // Type or member is obsolete
A.CallTo(() => session.BeginTransaction()).Returns(transaction);

var spec = new PersistenceSpecification<Cat>(session);
spec.VerifyTheMappings();

A.CallTo(() => session.Transaction).MustHaveHappened(Repeated.Exactly.Twice);
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).MustHaveHappened(1, Times.Exactly);
#pragma warning restore CS0618 // Type or member is obsolete
}

[Test]
Expand All @@ -62,7 +70,9 @@ public void Passed_Transaction_Should_Apply_For_Reference_Saving()
A.CallTo(() => transaction.IsActive).Returns(true);

var session = A.Fake<ISession>();
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).Returns(transaction);
#pragma warning restore CS0618 // Type or member is obsolete
A.CallTo(() => session.Get<Cat>(null)).WithAnyArguments()
.Returns(
new Cat
Expand All @@ -81,7 +91,9 @@ public void Passed_Transaction_Should_Apply_For_Reference_Saving()

spec.VerifyTheMappings();

A.CallTo(() => session.Transaction).MustHaveHappened(Repeated.Exactly.Twice);
#pragma warning disable CS0618 // Type or member is obsolete
A.CallTo(() => session.Transaction).MustHaveHappened(1, Times.Exactly);
#pragma warning restore CS0618 // Type or member is obsolete
A.CallTo(() => session.BeginTransaction()).MustNotHaveHappened();
}

Expand Down
4 changes: 2 additions & 2 deletions src/FluentNHibernate.Testing/Testing/Values/ListSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public override void because()
public void should_perform_the_check_with_the_custom_equality_comparer()
{
A.CallTo(() => sut.EntityEqualityComparer.Equals(null, null))
.WithAnyArguments().MustHaveHappened(Repeated.Exactly.Times(3));
.WithAnyArguments().MustHaveHappened(3, Times.Exactly);
}
}

Expand All @@ -443,7 +443,7 @@ public void should_perform_the_check_with_the_custom_equality_comparer()
{
A.CallTo(() => sut.EntityEqualityComparer.Equals(null, null))
.WithAnyArguments()
.MustHaveHappened(Repeated.Exactly.Once);
.MustHaveHappened(1, Times.Exactly);
}
}

Expand Down
20 changes: 17 additions & 3 deletions src/FluentNHibernate/Testing/PersistenceSpecification.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using FluentNHibernate.Testing.Values;
using FluentNHibernate.Utils;
using NHibernate;
using NHibernate.Impl;

namespace FluentNHibernate.Testing
{
Expand Down Expand Up @@ -31,10 +33,22 @@ public PersistenceSpecification(ISession session)
public PersistenceSpecification(ISession session, IEqualityComparer entityEqualityComparer)
{
currentSession = session;
hasExistingTransaction = currentSession.GetCurrentTransaction() != null || System.Transactions.Transaction.Current != null;
hasExistingTransaction = HasExistingTransaction(currentSession) || System.Transactions.Transaction.Current != null;
this.entityEqualityComparer = entityEqualityComparer;
}

//Only to make fake sessions possible in testing
private bool HasExistingTransaction(ISession currentSession)
{
if (currentSession is SessionImpl)
{
return currentSession.GetCurrentTransaction() != null;
}
#pragma warning disable CS0618 // Type or member is obsolete
return currentSession.Transaction?.IsActive == true;
#pragma warning restore CS0618 // Type or member is obsolete
}

public T VerifyTheMappings()
{
return VerifyTheMappings(typeof(T).InstantiateUsingParameterlessConstructor<T>());
Expand Down Expand Up @@ -63,7 +77,7 @@ public T VerifyTheMappings(T first)
// It's a bit naive right now because it fails on the first failure
allProperties.ForEach(p => p.CheckValue(second));

return second;
return second;
}

public void TransactionalSave(object propertyValue)
Expand Down