Refactor collection builders for IContainer
This commit is contained in:
@@ -3,8 +3,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Repositories.Implement;
|
||||
@@ -68,7 +68,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Act
|
||||
var script = new Script("test-add-script.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
|
||||
//Assert
|
||||
Assert.That(_fileSystem.FileExists("test-add-script.js"), Is.True);
|
||||
@@ -87,11 +87,11 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Act
|
||||
var script = new Script("test-updated-script.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
|
||||
script.Content = "/// <reference name=\"MicrosoftAjax-Updated.js\"/>";
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
|
||||
var scriptUpdated = repository.Get("test-updated-script.js");
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
// Act
|
||||
var script = repository.Get("test-script.js");
|
||||
repository.Delete(script);
|
||||
|
||||
|
||||
|
||||
// Assert
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
repository.Save(script2);
|
||||
var script3 = new Script("test-script3.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
|
||||
repository.Save(script3);
|
||||
|
||||
|
||||
|
||||
// Act
|
||||
var scripts = repository.GetMany();
|
||||
@@ -183,7 +183,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
repository.Save(script2);
|
||||
var script3 = new Script("test-script3.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
|
||||
repository.Save(script3);
|
||||
|
||||
|
||||
|
||||
// Act
|
||||
var scripts = repository.GetMany("test-script1.js", "test-script2.js");
|
||||
@@ -226,13 +226,13 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
var script = new Script("test-move-script.js") { Content = content };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
|
||||
// Act
|
||||
script = repository.Get("test-move-script.js");
|
||||
script.Path = "moved/test-move-script.js";
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
|
||||
var existsOld = repository.Exists("test-move-script.js");
|
||||
var existsNew = repository.Exists("moved/test-move-script.js");
|
||||
@@ -259,7 +259,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
var script = new Script("test-path-1.js") { Content = "// script" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
Assert.IsTrue(_fileSystem.FileExists("test-path-1.js"));
|
||||
Assert.AreEqual("test-path-1.js", script.Path);
|
||||
Assert.AreEqual("/scripts/test-path-1.js", script.VirtualPath);
|
||||
@@ -267,14 +267,14 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
//ensure you can prefix the same path as the root path name
|
||||
script = new Script("scripts/path-2/test-path-2.js") { Content = "// script" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
Assert.IsTrue(_fileSystem.FileExists("scripts/path-2/test-path-2.js"));
|
||||
Assert.AreEqual("scripts\\path-2\\test-path-2.js", script.Path);
|
||||
Assert.AreEqual("/scripts/scripts/path-2/test-path-2.js", script.VirtualPath);
|
||||
|
||||
script = new Script("path-2/test-path-2.js") { Content = "// script" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.js"));
|
||||
Assert.AreEqual("path-2\\test-path-2.js", script.Path); // fixed in 7.3 - 7.2.8 does not update the path
|
||||
Assert.AreEqual("/scripts/path-2/test-path-2.js", script.VirtualPath);
|
||||
@@ -286,7 +286,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
script = new Script("path-2\\test-path-3.js") { Content = "// script" };
|
||||
repository.Save(script);
|
||||
|
||||
|
||||
Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.js"));
|
||||
Assert.AreEqual("path-2\\test-path-3.js", script.Path);
|
||||
Assert.AreEqual("/scripts/path-2/test-path-3.js", script.VirtualPath);
|
||||
|
||||
Reference in New Issue
Block a user