From 0535a4ec7d6d01912deb8993fb4c6b07a1d25b2d Mon Sep 17 00:00:00 2001 From: Murat Cakir Date: Thu, 22 Jun 2017 19:15:03 +0200 Subject: [PATCH] Unit test fixes --- src/Libraries/SmartStore.Core/Data/DataSettings.cs | 2 +- src/Libraries/SmartStore.Core/Properties/AssemblyInfo.cs | 1 + src/Libraries/SmartStore.Core/Utilities/ObjectDumper.cs | 4 ---- src/Libraries/SmartStore.Data/SmartDbConfiguration.cs | 2 -- src/Tests/SmartStore.Data.Tests/GlobalSetup.cs | 6 ++---- 5 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/Libraries/SmartStore.Core/Data/DataSettings.cs b/src/Libraries/SmartStore.Core/Data/DataSettings.cs index f903cadc9a..146cc96bcb 100644 --- a/src/Libraries/SmartStore.Core/Data/DataSettings.cs +++ b/src/Libraries/SmartStore.Core/Data/DataSettings.cs @@ -206,7 +206,7 @@ public virtual bool Load() this.TenantName = curTenant; this.TenantPath = tenantPath; - if (File.Exists(filePath)) + if (File.Exists(filePath) && !s_TestMode) { string text = File.ReadAllText(filePath); var settings = ParseSettings(text); diff --git a/src/Libraries/SmartStore.Core/Properties/AssemblyInfo.cs b/src/Libraries/SmartStore.Core/Properties/AssemblyInfo.cs index 8d567e0e92..ddde4c0b4a 100644 --- a/src/Libraries/SmartStore.Core/Properties/AssemblyInfo.cs +++ b/src/Libraries/SmartStore.Core/Properties/AssemblyInfo.cs @@ -5,3 +5,4 @@ [assembly: InternalsVisibleTo("SmartStore.Core.Tests")] [assembly: InternalsVisibleTo("SmartStore.Services.Tests")] [assembly: InternalsVisibleTo("SmartStore.Web.Mvc.Tests")] +[assembly: InternalsVisibleTo("SmartStore.Data.Tests")] diff --git a/src/Libraries/SmartStore.Core/Utilities/ObjectDumper.cs b/src/Libraries/SmartStore.Core/Utilities/ObjectDumper.cs index 8ccba41fbb..788859fa99 100644 --- a/src/Libraries/SmartStore.Core/Utilities/ObjectDumper.cs +++ b/src/Libraries/SmartStore.Core/Utilities/ObjectDumper.cs @@ -1,10 +1,6 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Newtonsoft.Json; namespace SmartStore.Core.Utilities diff --git a/src/Libraries/SmartStore.Data/SmartDbConfiguration.cs b/src/Libraries/SmartStore.Data/SmartDbConfiguration.cs index e9961eb2f6..163b21ba8a 100644 --- a/src/Libraries/SmartStore.Data/SmartDbConfiguration.cs +++ b/src/Libraries/SmartStore.Data/SmartDbConfiguration.cs @@ -6,8 +6,6 @@ using SmartStore.Core.Infrastructure; using SmartStore.Data.Caching; using System.Web.Hosting; -using SmartStore.Utilities; -using System.Data.Entity.Migrations; namespace SmartStore.Data { diff --git a/src/Tests/SmartStore.Data.Tests/GlobalSetup.cs b/src/Tests/SmartStore.Data.Tests/GlobalSetup.cs index 6361a08031..2f246c14fd 100644 --- a/src/Tests/SmartStore.Data.Tests/GlobalSetup.cs +++ b/src/Tests/SmartStore.Data.Tests/GlobalSetup.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; using System.Data.Entity; -using System.Linq; -using System.Text; using NUnit.Framework; -using SmartStore.Data.Migrations; +using SmartStore.Core.Data; namespace SmartStore.Data.Tests { @@ -14,6 +11,7 @@ public class GlobalSetup [SetUp] public void SetUp() { + DataSettings.SetTestMode(true); var ctx = new SmartObjectContext(GetTestDbName()); Database.SetInitializer(new DropCreateDatabaseAlways()); ctx.Database.Initialize(true);