public void Can_Perform_Move_On_ScriptRepository() { const string content = "/// <reference name=\"MicrosoftAjax.js\"/>"; // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); var script = new Script("test-move-script.js") { Content = content }; repository.AddOrUpdate(script); unitOfWork.Commit(); // Act script = repository.Get("test-move-script.js"); script.Path = "moved/test-move-script.js"; repository.AddOrUpdate(script); unitOfWork.Commit(); var existsOld = repository.Exists("test-move-script.js"); var existsNew = repository.Exists("moved/test-move-script.js"); script = repository.Get("moved/test-move-script.js"); // Assert Assert.IsNotNull(script); Assert.IsFalse(existsOld); Assert.IsTrue(existsNew); Assert.AreEqual(content, script.Content); }
public void Can_Perform_Update_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem); // Act var script = new Script("test-updated-script.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" }; repository.AddOrUpdate(script); unitOfWork.Commit(); script.Content = "/// <reference name=\"MicrosoftAjax-Updated.js\"/>"; repository.AddOrUpdate(script); unitOfWork.Commit(); var scriptUpdated = repository.Get("test-updated-script.js"); // Assert Assert.That(_fileSystem.FileExists("test-updated-script.js"), Is.True); Assert.That(scriptUpdated.Content, Is.EqualTo("/// <reference name=\"MicrosoftAjax-Updated.js\"/>")); }
public void Can_Perform_Update_On_MacroRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); var macro = CreateMacro("updateMacro", "Update Macro"); repository.AddOrUpdate(macro); unitOfWork.Commit(); // Act var macro1 = repository.Get("updateMacro"); macro1.Xslt = "/xslt/updateTestMacro.xslt"; repository.AddOrUpdate(macro1); unitOfWork.Commit(); var macro2 = repository.Get("updateMacro"); // Assert Assert.That(macro2.CreateDate, Is.EqualTo(macro.CreateDate)); //Assert.That(macro2.ModifiedDate, Is.GreaterThan(macro.ModifiedDate)); Assert.That(macro2.Xslt, Is.EqualTo("/xslt/updateTestMacro.xslt")); }
public void Can_Perform_Update_With_Property() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of <IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var stylesheet = new Stylesheet("test-update.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); stylesheet.AddProperty(new StylesheetProperty("Test", "p", "font-size:2em;")); repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); //re-get stylesheet = repository.Get(stylesheet.Name); //Assert Assert.That(stylesheet.Content, Is.EqualTo(@"body { color:#000; } .bold {font-weight:bold;} /**umb_name:Test*/ p{font-size:2em;}")); Assert.AreEqual(1, stylesheet.Properties.Count()); }
public void Can_Perform_GetAll_With_Params() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of <IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); var stylesheet = new Stylesheet("styles-v2.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); // Act var stylesheets = repository.GetAll("styles-v2.css", "styles.css"); // Assert Assert.That(stylesheets, Is.Not.Null); Assert.That(stylesheets.Any(), Is.True); Assert.That(stylesheets.Any(x => x == null), Is.False); Assert.That(stylesheets.Count(), Is.EqualTo(2)); }
public void Can_Perform_Update() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of <IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var stylesheet = new Stylesheet("test-update.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); var stylesheetUpdate = repository.Get("test-update.css"); stylesheetUpdate.Content = "body { color:#000; }"; repository.AddOrUpdate(stylesheetUpdate); unitOfWork.Commit(); var stylesheetUpdated = repository.Get("test-update.css"); //Assert Assert.That(stylesheetUpdated, Is.Not.Null); Assert.That(stylesheetUpdated.HasIdentity, Is.True); Assert.That(stylesheetUpdated.Content, Is.EqualTo("body { color:#000; }")); }
public void Can_Instantiate_Repository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); // Act var repository = new ScriptRepository(unitOfWork, _fileSystem); // Assert Assert.That(repository, Is.Not.Null); }
public void Can_Instantiate_Repository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); // Act var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); // Assert Assert.That(repository, Is.Not.Null); }
public void Can_Instantiate_Repository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); // Act var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); // Assert Assert.That(repository, Is.Not.Null); }
public void Can_Perform_Exists_On_StylesheetRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var exists = repository.Exists("styles.css"); // Assert Assert.That(exists, Is.True); }
public void Can_Verify_Macro_File_Exists() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); // Act bool exists = repository.Exists("testMacro"); // Assert Assert.That(exists, Is.True); }
public void Cant_Find_Macro_File() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); // Act bool exists = repository.Exists("commentList"); // Assert Assert.That(exists, Is.False); }
public void Can_Perform_Exists_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); // Act var exists = repository.Exists("test-script.js"); // Assert Assert.That(exists, Is.True); }
public void Can_Perform_Get_On_MacroRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); var macro = CreateMacro("getMacro", "Get Macro"); repository.AddOrUpdate(macro); unitOfWork.Commit(); // Act var unitOfWork2 = provider.GetUnitOfWork(); var repository2 = new MacroRepository(unitOfWork2, NullCacheProvider.Current); var macro1 = repository2.Get("getMacro"); // Assert Assert.That(macro1.CreateDate, Is.GreaterThan(DateTime.MinValue)); Assert.That(macro1.UpdateDate, Is.GreaterThan(DateTime.MinValue)); Assert.That(macro1.Name, Is.EqualTo("Get Macro")); Assert.That(macro1.Properties.Any(), Is.True); Assert.That(macro1.Properties.Count, Is.EqualTo(2)); }
public void Can_Perform_Delete_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem); // Act var script = repository.Get("test-script.js"); repository.Delete(script); unitOfWork.Commit(); // Assert }
public void Can_Perform_Get_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); // Act var exists = repository.Get("test-script.js"); // Assert Assert.That(exists, Is.Not.Null); Assert.That(exists.Alias, Is.EqualTo("test-script")); Assert.That(exists.Name, Is.EqualTo("test-script.js")); }
public void Can_Perform_Add_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); // Act var script = new Script("test-add-script.js") {Content = "/// <reference name=\"MicrosoftAjax.js\"/>"}; repository.AddOrUpdate(script); unitOfWork.Commit(); //Assert Assert.That(_fileSystem.FileExists("test-add-script.js"), Is.True); }
public void Can_Perform_Get_On_StylesheetRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var stylesheet = repository.Get("styles.css"); // Assert Assert.That(stylesheet, Is.Not.Null); Assert.That(stylesheet.HasIdentity, Is.True); Assert.That(stylesheet.Content, Is.EqualTo("body {background:#EE7600; color:#FFF;}")); Assert.That(stylesheet.IsFileValidCss(), Is.True); }
public void Can_Perform_Delete_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); // Act var script = repository.Get("test-script.js"); repository.Delete(script); unitOfWork.Commit(); // Assert Assert.IsFalse(repository.Exists("test-script.js")); }
public void Can_Perform_GetAll_On_MacroRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); // Act var macros = repository.GetAll(); var list = macros.ToList(); // Assert Assert.That(list.Any(), Is.True); Assert.That(list.Any(x => x == null), Is.False); Assert.That(list.Count(), Is.GreaterThan(1)); Assert.That(list.Any(x => x.Alias == "getMacro"), Is.True); Assert.That(list.Any(x => x.Alias == "testMacro"), Is.True); }
public void Can_Perform_Add_On_StylesheetRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var stylesheet = new Stylesheet("test-add.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); //Assert Assert.That(_fileSystem.FileExists("test-add.css"), Is.True); }
public void Can_Perform_Delete_On_MacroRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); var macro = CreateMacro("deleteMacro", "Delete Macro"); repository.AddOrUpdate(macro); unitOfWork.Commit(); // Act repository.Delete(macro); unitOfWork.Commit(); var exists = repository.Exists("deleteMacro"); // Assert Assert.That(exists, Is.False); }
public void Throws_When_Adding_Duplicate_Properties() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of <IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); // Act var stylesheet = new Stylesheet("test-update.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); stylesheet.AddProperty(new StylesheetProperty("Test", "p", "font-size:2em;")); Assert.Throws <DuplicateNameException>(() => stylesheet.AddProperty(new StylesheetProperty("test", "p", "font-size:2em;"))); }
public void Can_Perform_Add_On_MacroRepository() { // Arrange var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new MacroRepository(unitOfWork, NullCacheProvider.Current); // Act var macro = new Macro { Alias = "testMacro", CacheByPage = false, CacheByMember = false, DontRender = true, Name = "Test Macro", Xslt = "/xslt/testMacro.xslt", UseInEditor = false }; macro.Properties = new List <IMacroProperty>(); macro.Properties.Add(new MacroProperty { Alias = "level", Name = "Level", SortOrder = 0, PropertyType = new Umbraco.Core.Macros.PropertyTypes.Number() }); repository.AddOrUpdate(macro); unitOfWork.Commit(); // Assert Assert.That(macro.CreateDate, Is.GreaterThan(DateTime.MinValue)); Assert.That(macro.UpdateDate, Is.GreaterThan(DateTime.MinValue)); }
public void Can_Perform_GetAll_With_Params_On_ScriptRepository() { // Arrange var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); var script = new Script("test-script1.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" }; repository.AddOrUpdate(script); var script2 = new Script("test-script2.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" }; repository.AddOrUpdate(script2); var script3 = new Script("test-script3.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" }; repository.AddOrUpdate(script3); unitOfWork.Commit(); // Act var scripts = repository.GetAll("test-script1.js", "test-script2.js"); // Assert Assert.That(scripts, Is.Not.Null); Assert.That(scripts.Any(), Is.True); Assert.That(scripts.Any(x => x == null), Is.False); Assert.That(scripts.Count(), Is.EqualTo(2)); }
public void PathTests() { // unless noted otherwise, no changes / 7.2.8 var provider = new FileUnitOfWorkProvider(Mock.Of <IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new StylesheetRepository(unitOfWork, _fileSystem); var stylesheet = new Stylesheet("test-path-1.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("test-path-1.css")); Assert.AreEqual("test-path-1.css", stylesheet.Path); Assert.AreEqual("/css/test-path-1.css", stylesheet.VirtualPath); stylesheet = new Stylesheet("path-2/test-path-2.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.css")); Assert.AreEqual("path-2\\test-path-2.css", stylesheet.Path); // fixed in 7.3 - 7.2.8 does not update the path Assert.AreEqual("/css/path-2/test-path-2.css", stylesheet.VirtualPath); stylesheet = repository.Get("path-2/test-path-2.css"); Assert.IsNotNull(stylesheet); Assert.AreEqual("path-2\\test-path-2.css", stylesheet.Path); Assert.AreEqual("/css/path-2/test-path-2.css", stylesheet.VirtualPath); stylesheet = new Stylesheet("path-2\\test-path-3.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; repository.AddOrUpdate(stylesheet); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.css")); Assert.AreEqual("path-2\\test-path-3.css", stylesheet.Path); Assert.AreEqual("/css/path-2/test-path-3.css", stylesheet.VirtualPath); stylesheet = repository.Get("path-2/test-path-3.css"); Assert.IsNotNull(stylesheet); Assert.AreEqual("path-2\\test-path-3.css", stylesheet.Path); Assert.AreEqual("/css/path-2/test-path-3.css", stylesheet.VirtualPath); stylesheet = repository.Get("path-2\\test-path-3.css"); Assert.IsNotNull(stylesheet); Assert.AreEqual("path-2\\test-path-3.css", stylesheet.Path); Assert.AreEqual("/css/path-2/test-path-3.css", stylesheet.VirtualPath); stylesheet = new Stylesheet("\\test-path-4.css") { Content = "body { color:#000; } .bold {font-weight:bold;}" }; Assert.Throws <FileSecurityException>(() => // fixed in 7.3 - 7.2.8 used to strip the \ { repository.AddOrUpdate(stylesheet); }); // fixed in 7.3 - 7.2.8 used to throw stylesheet = repository.Get("missing.css"); Assert.IsNull(stylesheet); // fixed in 7.3 - 7.2.8 used to... Assert.Throws <FileSecurityException>(() => { stylesheet = repository.Get("\\test-path-4.css"); // outside the filesystem, does not exist }); Assert.Throws <FileSecurityException>(() => { stylesheet = repository.Get("../packages.config"); // outside the filesystem, exists }); }
public void PathTests() { // unless noted otherwise, no changes / 7.2.8 var provider = new FileUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new PartialViewRepository(unitOfWork, _fileSystem); var partialView = new PartialView("test-path-1.cshtml") { Content = "// partialView" }; repository.AddOrUpdate(partialView); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("test-path-1.cshtml")); Assert.AreEqual("test-path-1.cshtml", partialView.Path); Assert.AreEqual("/Views/Partials/test-path-1.cshtml", partialView.VirtualPath); partialView = new PartialView("path-2/test-path-2.cshtml") { Content = "// partialView" }; repository.AddOrUpdate(partialView); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-2.cshtml")); Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path); // fixed in 7.3 - 7.2.8 does not update the path Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath); partialView = (PartialView)repository.Get("path-2/test-path-2.cshtml"); Assert.IsNotNull(partialView); Assert.AreEqual("path-2\\test-path-2.cshtml", partialView.Path); Assert.AreEqual("/Views/Partials/path-2/test-path-2.cshtml", partialView.VirtualPath); partialView = new PartialView("path-2\\test-path-3.cshtml") { Content = "// partialView" }; repository.AddOrUpdate(partialView); unitOfWork.Commit(); Assert.IsTrue(_fileSystem.FileExists("path-2/test-path-3.cshtml")); Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path); Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath); partialView = (PartialView)repository.Get("path-2/test-path-3.cshtml"); Assert.IsNotNull(partialView); Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path); Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath); partialView = (PartialView)repository.Get("path-2\\test-path-3.cshtml"); Assert.IsNotNull(partialView); Assert.AreEqual("path-2\\test-path-3.cshtml", partialView.Path); Assert.AreEqual("/Views/Partials/path-2/test-path-3.cshtml", partialView.VirtualPath); partialView = new PartialView("\\test-path-4.cshtml") { Content = "// partialView" }; Assert.Throws <FileSecurityException>(() => // fixed in 7.3 - 7.2.8 used to strip the \ { repository.AddOrUpdate(partialView); }); partialView = (PartialView)repository.Get("missing.cshtml"); Assert.IsNull(partialView); // fixed in 7.3 - 7.2.8 used to... Assert.Throws <FileSecurityException>(() => { partialView = (PartialView)repository.Get("\\test-path-4.cshtml"); // outside the filesystem, does not exist }); Assert.Throws <FileSecurityException>(() => { partialView = (PartialView)repository.Get("../../packages.config"); // outside the filesystem, exists }); }
public void PathTests() { // unless noted otherwise, no changes / 7.2.8 var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>()); var unitOfWork = provider.GetUnitOfWork(); var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>()); var script = new Script("test-path-1.js") { Content = "// script" }; repository.AddOrUpdate(script); unitOfWork.Commit(); 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); //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.AddOrUpdate(script); unitOfWork.Commit(); 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.AddOrUpdate(script); unitOfWork.Commit(); 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); script = repository.Get("path-2/test-path-2.js"); Assert.IsNotNull(script); Assert.AreEqual("path-2\\test-path-2.js", script.Path); Assert.AreEqual("/scripts/path-2/test-path-2.js", script.VirtualPath); script = new Script("path-2\\test-path-3.js") { Content = "// script" }; repository.AddOrUpdate(script); unitOfWork.Commit(); 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); script = repository.Get("path-2/test-path-3.js"); Assert.IsNotNull(script); Assert.AreEqual("path-2\\test-path-3.js", script.Path); Assert.AreEqual("/scripts/path-2/test-path-3.js", script.VirtualPath); script = repository.Get("path-2\\test-path-3.js"); Assert.IsNotNull(script); Assert.AreEqual("path-2\\test-path-3.js", script.Path); Assert.AreEqual("/scripts/path-2/test-path-3.js", script.VirtualPath); script = new Script("\\test-path-4.js") { Content = "// script" }; Assert.Throws<FileSecurityException>(() => // fixed in 7.3 - 7.2.8 used to strip the \ { repository.AddOrUpdate(script); }); script = repository.Get("missing.js"); Assert.IsNull(script); // fixed in 7.3 - 7.2.8 used to... Assert.Throws<FileSecurityException>(() => { script = repository.Get("\\test-path-4.js"); // outside the filesystem, does not exist }); Assert.Throws<FileSecurityException>(() => { script = repository.Get("../packages.config"); // outside the filesystem, exists }); }