From 36f367f9d64cf360b1a751239fb24e937e2e88f8 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Wed, 7 Nov 2012 09:40:33 +0500 Subject: [PATCH] Added a unit test to confirm any ctor of a custom typed file system --- .../IO/FileSystemProviderManagerTests.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs b/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs index 3888106e70..28706303d3 100644 --- a/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs +++ b/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using NUnit.Framework; @@ -11,7 +12,7 @@ namespace Umbraco.Tests.IO public class FileSystemProviderManagerTests { [Test] - public void Can_Get_File_System() + public void Can_Get_Base_File_System() { var fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media); @@ -25,5 +26,26 @@ namespace Umbraco.Tests.IO Assert.NotNull(fs); } - } + + [Test] + public void Exception_Thrown_On_Invalid_Typed_File_System() + { + Assert.Throws(() => FileSystemProviderManager.Current.GetFileSystemProvider()); + } + + #region + + /// + /// Used in unit tests, for a typed file system we need to inherit from FileSystemWrapper and they MUST have a ctor + /// that only accepts a base IFileSystem object + /// + internal class InvalidTypedFileSystem : FileSystemWrapper + { + public InvalidTypedFileSystem(IFileSystem wrapped, string invalidParam) : base(wrapped) + { + } + } + + #endregion + } }