Added a unit test to confirm any ctor of a custom typed file system
This commit is contained in:
@@ -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<InvalidOperationException>(() => FileSystemProviderManager.Current.GetFileSystemProvider<InvalidTypedFileSystem>());
|
||||
}
|
||||
|
||||
#region
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
internal class InvalidTypedFileSystem : FileSystemWrapper
|
||||
{
|
||||
public InvalidTypedFileSystem(IFileSystem wrapped, string invalidParam) : base(wrapped)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user