diff --git a/Nuget.config b/Nuget.config
index 0e97909..d81b344 100644
--- a/Nuget.config
+++ b/Nuget.config
@@ -1,8 +1,7 @@
-
+
-
-
\ No newline at end of file
+
diff --git a/src/Smidge.Core/Cache/PhysicalFileCacheFileSystem.cs b/src/Smidge.Core/Cache/PhysicalFileCacheFileSystem.cs
index dfc8070..bb86729 100644
--- a/src/Smidge.Core/Cache/PhysicalFileCacheFileSystem.cs
+++ b/src/Smidge.Core/Cache/PhysicalFileCacheFileSystem.cs
@@ -1,5 +1,6 @@
-using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
using Smidge.Hashing;
using Smidge.Models;
using System;
@@ -13,7 +14,8 @@ public class PhysicalFileCacheFileSystem : ICacheFileSystem
public static PhysicalFileCacheFileSystem CreatePhysicalFileCacheFileSystem(
IHasher hasher,
ISmidgeConfig config,
- IHostEnvironment hosting)
+ IHostEnvironment hosting,
+ ILogger logger)
{
var cacheFolder = Path.Combine(hosting.ContentRootPath, config.DataFolder, "Cache", Environment.MachineName.ReplaceNonAlphanumericChars('-'));
@@ -22,18 +24,21 @@ public static PhysicalFileCacheFileSystem CreatePhysicalFileCacheFileSystem(
var cacheFileProvider = new PhysicalFileProvider(cacheFolder);
- return new PhysicalFileCacheFileSystem(cacheFileProvider, hasher);
+ return new PhysicalFileCacheFileSystem(cacheFileProvider, hasher, logger);
}
private readonly IHasher _hasher;
private readonly PhysicalFileProvider _fileProvider;
+ private readonly ILogger _logger;
public PhysicalFileCacheFileSystem(
PhysicalFileProvider cacheFileProvider,
- IHasher hasher)
+ IHasher hasher,
+ ILogger logger)
{
_fileProvider = cacheFileProvider;
_hasher = hasher;
+ _logger = logger;
}
public IFileInfo GetRequiredFileInfo(string filePath)
@@ -42,7 +47,7 @@ public IFileInfo GetRequiredFileInfo(string filePath)
if (!fileInfo.Exists)
{
- throw new FileNotFoundException($"No such file exists {fileInfo.PhysicalPath ?? fileInfo.Name} (mapped from {filePath})", fileInfo.PhysicalPath ?? fileInfo.Name);
+ _logger.LogError("No such file exists {FileName} (mapped from {FilePath})", fileInfo.PhysicalPath ?? fileInfo.Name, filePath);
}
return fileInfo;
diff --git a/src/Smidge.Core/FileProcessors/CssImportProcessor.cs b/src/Smidge.Core/FileProcessors/CssImportProcessor.cs
index 245a69e..d7a24cb 100644
--- a/src/Smidge.Core/FileProcessors/CssImportProcessor.cs
+++ b/src/Smidge.Core/FileProcessors/CssImportProcessor.cs
@@ -1,6 +1,7 @@
-using Smidge.Models;
+using Smidge.Models;
using System;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -48,6 +49,12 @@ public async Task ProcessAsync(FileProcessContext fileProcessContext, PreProcess
{
//it's internal (in theory)
var filePath = _fileSystem.GetRequiredFileInfo(path);
+
+ if (!filePath.Exists)
+ {
+ throw new FileNotFoundException(filePath.PhysicalPath ?? filePath.Name);
+ }
+
var content = await _fileSystem.ReadContentsAsync(filePath);
//This needs to be put back through the whole pre-processor pipeline before being added,
@@ -126,4 +133,4 @@ internal string ParseImportStatements(string content, out IEnumerable im
}
-}
\ No newline at end of file
+}
diff --git a/src/Smidge.Core/FileProcessors/PreProcessManager.cs b/src/Smidge.Core/FileProcessors/PreProcessManager.cs
index 5d6f8fb..595b345 100644
--- a/src/Smidge.Core/FileProcessors/PreProcessManager.cs
+++ b/src/Smidge.Core/FileProcessors/PreProcessManager.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
@@ -76,7 +76,17 @@ private async Task ProcessFileImpl(IWebFile file, BundleOptions bundleOptions, B
var cacheBusterValue = bundleContext.CacheBusterValue;
//we're making this lazy since we don't always want to resolve it
- var sourceFile = new Lazy(() => _fileSystem.GetRequiredFileInfo(file), LazyThreadSafetyMode.None);
+ var sourceFile = new Lazy(() =>
+ {
+ var fileInfo = _fileSystem.GetRequiredFileInfo(file);
+
+ if (!fileInfo.Exists)
+ {
+ throw new FileNotFoundException(fileInfo.PhysicalPath ?? fileInfo.Name);
+ }
+
+ return fileInfo;
+ }, LazyThreadSafetyMode.None);
var cacheFile = _fileSystem.CacheFileSystem.GetCacheFile(file, () => sourceFile.Value, fileWatchEnabled, extension, cacheBusterValue, out var filePath);
@@ -127,4 +137,4 @@ private static void FileModified(WatchedFile file)
file.BundleOptions.FileWatchOptions.Changed(new FileWatchEventArgs(file));
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Smidge.Core/ISmidgeFileSystem.cs b/src/Smidge.Core/ISmidgeFileSystem.cs
index 2ec7003..2374fba 100644
--- a/src/Smidge.Core/ISmidgeFileSystem.cs
+++ b/src/Smidge.Core/ISmidgeFileSystem.cs
@@ -21,17 +21,17 @@ public interface ISmidgeFileSystem
///
///
///
- /// Throws an exception if the file doesn't exist
+ /// Returns even if the file doesn't exist
///
IFileInfo GetRequiredFileInfo(IWebFile webfile);
///
/// Get a required
///
- ///
+ ///
///
///
- /// Throws an exception if the file doesn't exist
+ /// Returns even if the file doesn't exist
///
IFileInfo GetRequiredFileInfo(string filePath);
diff --git a/src/Smidge.Core/SmidgeFileSystem.cs b/src/Smidge.Core/SmidgeFileSystem.cs
index 041a68e..7e2bf09 100644
--- a/src/Smidge.Core/SmidgeFileSystem.cs
+++ b/src/Smidge.Core/SmidgeFileSystem.cs
@@ -8,6 +8,7 @@
using Smidge.Options;
using Smidge.Cache;
using System.Linq;
+using Microsoft.Extensions.Logging;
namespace Smidge
{
@@ -21,17 +22,20 @@ public sealed class SmidgeFileSystem : ISmidgeFileSystem
private readonly IWebsiteInfo _siteInfo;
private readonly IFileProvider _sourceFileProvider;
private readonly IFileProviderFilter _fileProviderFilter;
+ private readonly ILogger _logger;
public SmidgeFileSystem(
IFileProvider sourceFileProvider,
IFileProviderFilter fileProviderFilter,
ICacheFileSystem cacheFileProvider,
- IWebsiteInfo siteInfo)
+ IWebsiteInfo siteInfo,
+ ILogger logger)
{
_sourceFileProvider = sourceFileProvider;
_fileProviderFilter = fileProviderFilter;
CacheFileSystem = cacheFileProvider;
_siteInfo = siteInfo;
+ _logger = logger;
}
public ICacheFileSystem CacheFileSystem { get; }
@@ -43,7 +47,7 @@ public IFileInfo GetRequiredFileInfo(IWebFile webfile)
if (!fileInfo.Exists)
{
- throw new FileNotFoundException($"No such file exists {fileInfo.PhysicalPath ?? fileInfo.Name} (mapped from {path})", fileInfo.PhysicalPath ?? fileInfo.Name);
+ _logger.LogError("No such file exists {FileName} (mapped from {FilePath})", fileInfo.PhysicalPath ?? fileInfo.Name, path);
}
return fileInfo;
@@ -56,7 +60,7 @@ public IFileInfo GetRequiredFileInfo(string filePath)
if (!fileInfo.Exists)
{
- throw new FileNotFoundException($"No such file exists {fileInfo.PhysicalPath ?? fileInfo.Name} (mapped from {filePath})", fileInfo.PhysicalPath ?? fileInfo.Name);
+ _logger.LogError("No such file exists {FileName} (mapped from {FilePath})", fileInfo.PhysicalPath ?? fileInfo.Name, filePath);
}
return fileInfo;
diff --git a/src/Smidge.InMemory/ConfiguredCacheFileSystem.cs b/src/Smidge.InMemory/ConfiguredCacheFileSystem.cs
index 219b220..e438bea 100644
--- a/src/Smidge.InMemory/ConfiguredCacheFileSystem.cs
+++ b/src/Smidge.InMemory/ConfiguredCacheFileSystem.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
@@ -10,6 +10,7 @@
using System;
using System.IO;
using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
namespace Smidge.InMemory
{
@@ -31,14 +32,19 @@ public ConfiguredCacheFileSystem(IOptions options, IServiceProvid
if (_options.CacheOptions.UseInMemoryCache)
{
- _wrapped = new MemoryCacheFileSystem(hasher);
+ var logger = services.GetRequiredService>();
+
+ _wrapped = new MemoryCacheFileSystem(hasher, logger);
}
else
{
+ var logger = services.GetRequiredService>();
+
_wrapped = PhysicalFileCacheFileSystem.CreatePhysicalFileCacheFileSystem(
hasher,
services.GetRequiredService(),
- services.GetRequiredService());
+ services.GetRequiredService(),
+ logger);
}
}
diff --git a/src/Smidge.InMemory/MemoryCacheFileSystem.cs b/src/Smidge.InMemory/MemoryCacheFileSystem.cs
index 38783f2..485827d 100644
--- a/src/Smidge.InMemory/MemoryCacheFileSystem.cs
+++ b/src/Smidge.InMemory/MemoryCacheFileSystem.cs
@@ -1,7 +1,8 @@
-using Dazinator.Extensions.FileProviders;
+using Dazinator.Extensions.FileProviders;
using Dazinator.Extensions.FileProviders.InMemory;
using Dazinator.Extensions.FileProviders.InMemory.Directory;
using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Logging;
using Smidge.Cache;
using Smidge.Hashing;
using Smidge.Models;
@@ -17,12 +18,14 @@ public class MemoryCacheFileSystem : ICacheFileSystem
private readonly IDirectory _directory;
private readonly IHasher _hasher;
private readonly IFileProvider _fileProvider;
+ private readonly ILogger _logger;
- public MemoryCacheFileSystem(IHasher hasher)
+ public MemoryCacheFileSystem(IHasher hasher, ILogger logger)
{
_directory = new InMemoryDirectory();
_fileProvider = new InMemoryFileProvider(_directory);
_hasher = hasher;
+ _logger = logger;
}
public IFileInfo GetRequiredFileInfo(string filePath)
@@ -31,7 +34,7 @@ public IFileInfo GetRequiredFileInfo(string filePath)
if (!fileInfo.Exists)
{
- throw new FileNotFoundException($"No such file exists {fileInfo.PhysicalPath ?? fileInfo.Name} (mapped from {filePath})", fileInfo.PhysicalPath ?? fileInfo.Name);
+ _logger.LogError("No such file exists {FileName} (mapped from {FilePath})", fileInfo.PhysicalPath ?? fileInfo.Name, filePath);
}
return fileInfo;
diff --git a/src/Smidge/SmidgeStartup.cs b/src/Smidge/SmidgeStartup.cs
index 81249e9..533e11a 100644
--- a/src/Smidge/SmidgeStartup.cs
+++ b/src/Smidge/SmidgeStartup.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Infrastructure;
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
+using Microsoft.Extensions.Logging;
[assembly: InternalsVisibleTo("Smidge.Tests")]
@@ -47,6 +48,7 @@ public static IServiceCollection AddSmidge(this IServiceCollection services, ICo
services.AddSingleton(p =>
{
var hosting = p.GetRequiredService();
+ var logger = p.GetRequiredService>();
//resolve the ISmidgeFileProvider if there is one
var provider = p.GetService() ?? hosting.WebRootFileProvider;
@@ -54,13 +56,15 @@ public static IServiceCollection AddSmidge(this IServiceCollection services, ICo
provider,
p.GetRequiredService(),
p.GetRequiredService(),
- p.GetRequiredService());
+ p.GetRequiredService(),
+ logger);
});
services.AddSingleton(p => PhysicalFileCacheFileSystem.CreatePhysicalFileCacheFileSystem(
p.GetRequiredService(),
p.GetRequiredService(),
- p.GetRequiredService()));
+ p.GetRequiredService(),
+ p.GetRequiredService>()));
services.AddSingleton((p) =>
{
diff --git a/test/Smidge.Tests/BundleFileSetGeneratorTests.cs b/test/Smidge.Tests/BundleFileSetGeneratorTests.cs
index dcfb645..9f451bd 100644
--- a/test/Smidge.Tests/BundleFileSetGeneratorTests.cs
+++ b/test/Smidge.Tests/BundleFileSetGeneratorTests.cs
@@ -9,6 +9,7 @@
using Smidge.Hashing;
using Smidge.Options;
using System.Linq;
+using Microsoft.Extensions.Logging;
using Smidge.FileProcessors;
using Microsoft.Extensions.Options;
using Smidge.Cache;
@@ -28,9 +29,10 @@ public void Get_Ordered_File_Set_No_Duplicates()
var fileProvider = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
- var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of());
+ var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of(), logger.Object);
var pipeline = new PreProcessPipeline(Enumerable.Empty());
var smidgeOptions = new Mock>();
smidgeOptions.Setup(opt => opt.Value).Returns(new SmidgeOptions());
@@ -58,9 +60,10 @@ public void Get_Ordered_File_External_Set()
var fileProvider = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
- var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of());
+ var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of(), logger.Object);
var pipeline = new PreProcessPipeline(Enumerable.Empty());
var smidgeOptions = new Mock>();
smidgeOptions.Setup(opt => opt.Value).Returns(new SmidgeOptions());
@@ -89,9 +92,10 @@ public void Get_Ordered_File_Set_Correct_Order()
var fileProvider = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
- var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of());
+ var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of(), logger.Object);
var pipeline = new PreProcessPipeline(Enumerable.Empty());
var smidgeOptions = new Mock>();
smidgeOptions.Setup(opt => opt.Value).Returns(new SmidgeOptions());
diff --git a/test/Smidge.Tests/CssImportProcessorTests.cs b/test/Smidge.Tests/CssImportProcessorTests.cs
index d755721..333fcb3 100644
--- a/test/Smidge.Tests/CssImportProcessorTests.cs
+++ b/test/Smidge.Tests/CssImportProcessorTests.cs
@@ -1,5 +1,6 @@
-using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Logging;
using Moq;
using Smidge.Cache;
using Smidge.FileProcessors;
@@ -69,7 +70,8 @@ private ISmidgeFileSystem GetFileSystem()
Mock.Of(),
Mock.Of(),
Mock.Of(),
- Mock.Of());
+ Mock.Of(),
+ Mock.Of());
return fileSystem;
}
@@ -81,4 +83,4 @@ private IWebsiteInfo GetWebsiteInfo()
return websiteInfo.Object;
}
}
-}
\ No newline at end of file
+}
diff --git a/test/Smidge.Tests/FileBatcherTests.cs b/test/Smidge.Tests/FileBatcherTests.cs
index b4d9e57..d889aa9 100644
--- a/test/Smidge.Tests/FileBatcherTests.cs
+++ b/test/Smidge.Tests/FileBatcherTests.cs
@@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Logging;
using Xunit;
using Smidge.Hashing;
using Smidge.Cache;
@@ -28,10 +29,11 @@ public void Get_Composite_File_Collection_For_Url_Generation_No_Duplicates()
var fileProvider = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
var hasher = Mock.Of();
- var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of());
+ var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of(), logger.Object);
var batcher = new FileBatcher(fileSystemHelper, urlHelper, hasher);
var file = new Mock();
@@ -59,9 +61,10 @@ public void Get_Composite_File_Collection_For_Url_Generation()
var fileProvider = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
var hasher = Mock.Of();
- var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of());
+ var fileSystemHelper = new SmidgeFileSystem(fileProvider.Object, fileProviderFilter, cacheProvider.Object, Mock.Of(), logger.Object);
var batcher = new FileBatcher(fileSystemHelper, urlHelper, hasher);
var file = new Mock();
diff --git a/test/Smidge.Tests/SmidgeFileSystemTests.cs b/test/Smidge.Tests/SmidgeFileSystemTests.cs
index c5878c8..304e0f1 100644
--- a/test/Smidge.Tests/SmidgeFileSystemTests.cs
+++ b/test/Smidge.Tests/SmidgeFileSystemTests.cs
@@ -3,19 +3,22 @@
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.FileProviders;
+using Microsoft.Extensions.Logging;
using Xunit;
using Smidge.Cache;
+using System.Collections.Generic;
namespace Smidge.Tests
{
public class SmidgeFileSystemTests
{
- private ISmidgeFileSystem Create(IWebsiteInfo websiteInfo, string url = "~/Js/Test1.js")
+ private ISmidgeFileSystem Create(IWebsiteInfo websiteInfo, out Mock logger, string url = "~/Js/Test1.js")
{
var webRootPath = $"C:{Path.DirectorySeparatorChar}MySolution{Path.DirectorySeparatorChar}MyProject";
var cacheProvider = new Mock();
var fileProvider = new Mock();
+ logger = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
var file = new Mock();
string filePath = Path.Combine(webRootPath, $"Js{Path.DirectorySeparatorChar}Test1.js");
@@ -33,7 +36,8 @@ private ISmidgeFileSystem Create(IWebsiteInfo websiteInfo, string url = "~/Js/Te
fileProvider.Object,
fileProviderFilter,
cacheProvider.Object,
- websiteInfo);
+ websiteInfo,
+ logger.Object);
return helper;
@@ -55,7 +59,7 @@ public void ConvertToFileProviderPath(string from, string to, string pathBase)
{
websiteInfo.Setup(x => x.GetBasePath()).Returns(pathBase);
}
- var fs = Create(websiteInfo.Object);
+ var fs = Create(websiteInfo.Object, out _);
var result = fs.ConvertToFileProviderPath(from);
@@ -63,7 +67,7 @@ public void ConvertToFileProviderPath(string from, string to, string pathBase)
}
[Fact]
- public void Get_File_Info_Non_Existent_File_Throws_Informative_Exception()
+ public void Get_File_Info_Non_Existent_File_Logs_Informative_Error()
{
var url = "~/Js/Test1.js";
@@ -71,13 +75,19 @@ public void Get_File_Info_Non_Existent_File_Throws_Informative_Exception()
websiteInfo.Setup(x => x.GetBasePath()).Returns(string.Empty);
websiteInfo.Setup(x => x.GetBaseUrl()).Returns(new Uri("http://test.com"));
- var helper = Create(websiteInfo.Object, url);
+ var helper = Create(websiteInfo.Object, out var logger, url);
- FileNotFoundException ex = Assert.Throws(() => helper.GetRequiredFileInfo(url));
+ helper.GetRequiredFileInfo(url);
- // var result = helper.MapPath(url);
-
- Assert.Contains(url, ex.Message);
+ logger.Verify(
+ x => x.Log(
+ LogLevel.Error,
+ 0,
+ It.Is((v, t) => v.ToString().Contains(url)),
+ null,
+ It.IsAny>()
+ )
+ );
}
[Fact]
@@ -95,6 +105,7 @@ public void Reverse_Map_Path()
var urlHelper = new Mock();
var cacheProvider = new Mock();
+ var logger = new Mock();
var fileProvider = new Mock();
var fileProviderFilter = new DefaultFileProviderFilter();
@@ -103,7 +114,8 @@ public void Reverse_Map_Path()
fileProvider.Object,
fileProviderFilter,
cacheProvider.Object,
- Mock.Of());
+ Mock.Of(),
+ logger.Object);
var result = helper.ReverseMapPath(subPath, file.Object);
diff --git a/test/Smidge.Tests/SmidgeHelperTests.cs b/test/Smidge.Tests/SmidgeHelperTests.cs
index 71ff88d..77a4620 100644
--- a/test/Smidge.Tests/SmidgeHelperTests.cs
+++ b/test/Smidge.Tests/SmidgeHelperTests.cs
@@ -23,6 +23,7 @@ public class SmidgeHelperTests
private readonly IUrlManager _urlManager = Mock.Of();
private readonly IFileProvider _fileProvider = Mock.Of();
private readonly ICacheFileSystem _cacheProvider = Mock.Of();
+ private readonly ILogger _logger = Mock.Of();
private readonly IFileProviderFilter _fileProviderFilter = Mock.Of();
private readonly IHasher _hasher = Mock.Of();
private readonly IEnumerable _preProcessors = new List();
@@ -46,7 +47,7 @@ public SmidgeHelperTests()
_httpContextAccessor.Setup(x => x.HttpContext).Returns(_httpContext.Object);
_dynamicallyRegisteredWebFiles = new DynamicallyRegisteredWebFiles();
- _fileSystemHelper = new SmidgeFileSystem(_fileProvider, _fileProviderFilter, _cacheProvider, Mock.Of());
+ _fileSystemHelper = new SmidgeFileSystem(_fileProvider, _fileProviderFilter, _cacheProvider, Mock.Of(), _logger);
_smidgeOptions = new Mock>();
_smidgeOptions.Setup(opt => opt.Value).Returns(new SmidgeOptions
{