From PetaPoco to NPoco (#1207)
* NPoco - 2.x (builds) * NPoco - v3.1 (does not build) * NPoco - builds * NPoco - configure database factory (tests fail) * Pick fix from 7.4 * NPoco - stock v3.1 - sort-of working * NPoco - fix merge * Fix Newtonsoft.Json in web.Template.Debug.config * NPoco - fix SELECT * * NPoco - fixing repositories * NPoco - fix EntityRepository * NPoco - fix EntityRepository * NPoco - cosmetic * NPoco - use 3.1.0-u001 from github/zpqrtbnk/NPoco * Fixes build, NPoco needed to be referenced in the cms and UmbracoExamine projects * Fixes lots of tests * fixes more tests * NPoco - bugfixing * Bugfix CacheHelper in tests * Bugfix connection mocking in tests * NPoco - inject database in Sql.Select<> * NPoco - discovery retry policy only once * Enable C# 6 for Umbraco.Core * NPoco - introduce UmbracoSql, cleanup * NPoco - more cleanup and fixing * NPoco - fix UserRepository * Optimize InGroupsOf * Implement UmbracoDatabase.FetchByGroups * NPoco - fix Select * NPoco - simplify GetPagedResultsByQuery * Cherry-pick DisableBrowserCacheAttribute fix from 7.4 * Upgrade NPoco to use Sql<TContext> * U4-8257 - cleanup relators * 4-8257 - cleanup more relators * Upgrade NPoco with more OOTB version * fixes a couple tests, changes double check lock to Lazy<T>
This commit is contained in:
committed by
Shannon Deminick
parent
1b8747bd6d
commit
365a01a476
@@ -1,5 +1,6 @@
|
||||
using LightInject;
|
||||
using Moq;
|
||||
using NPoco;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
@@ -9,28 +10,31 @@ using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Profiling;
|
||||
using Umbraco.Core.DependencyInjection;
|
||||
using Umbraco.Core.Persistence;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
[TestFixture]
|
||||
public abstract class BaseUsingSqlCeSyntax
|
||||
{
|
||||
protected virtual SqlCeSyntaxProvider SqlSyntax
|
||||
{
|
||||
get { return new SqlCeSyntaxProvider(); }
|
||||
}
|
||||
|
||||
private MappingResolver _mappingResolver;
|
||||
protected IMappingResolver MappingResolver
|
||||
|
||||
protected IMappingResolver MappingResolver => _mappingResolver;
|
||||
|
||||
protected SqlContext SqlContext { get; private set; }
|
||||
|
||||
protected Sql<SqlContext> Sql()
|
||||
{
|
||||
get { return _mappingResolver; }
|
||||
return NPoco.Sql.BuilderFor(SqlContext);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public virtual void Initialize()
|
||||
{
|
||||
var sqlSyntax = new SqlCeSyntaxProvider();
|
||||
|
||||
var container = new ServiceContainer();
|
||||
container.RegisterSingleton<ISqlSyntaxProvider>(factory => SqlSyntax);
|
||||
container.RegisterSingleton<ISqlSyntaxProvider>(factory => sqlSyntax);
|
||||
container.RegisterSingleton<ILogger>(factory => Mock.Of<ILogger>());
|
||||
container.RegisterSingleton<IProfiler>(factory => Mock.Of<IProfiler>());
|
||||
|
||||
@@ -43,6 +47,10 @@ namespace Umbraco.Tests.TestHelpers
|
||||
logger,
|
||||
false);
|
||||
|
||||
var mappers = new MapperCollection { new PocoMapper() };
|
||||
var pocoDataFactory = new FluentPocoDataFactory((type, iPocoDataFactory) => new PocoDataBuilder(type, mappers).Init());
|
||||
SqlContext = new SqlContext(sqlSyntax, pocoDataFactory, DatabaseType.SQLCe);
|
||||
|
||||
Resolution.Freeze();
|
||||
SetUp();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user