public void Customize(IFixture fixture) { fixture.Register <IYesSpaConfiguration>(() => { var mockEmbeddedFileProvider = new Mock <IFileProvider>(); mockEmbeddedFileProvider.Setup(x => x.GetFileInfo(It.IsAny <string>())) .Returns <string>(path => { var mockFileInfo = new Mock <IFileInfo>(); mockFileInfo.SetupGet(x => x.PhysicalPath).Returns(path); return(EmbeddedResources.Any(s => s == path) ? mockFileInfo.Object : null); }); var mockDefaultPageRewrite = new Mock <IDefaultPageRewrite>(); mockDefaultPageRewrite.Setup(x => x.MatchRequest(It.IsAny <PathString>())) .Returns <PathString>(requestPath => { return(RewritePaths.ContainsKey(requestPath) ? (true, RewritePaths[requestPath]) : (false, null)); }); var configuration = new Mock <IYesSpaConfiguration>(); IList <IDefaultPageRewrite> defaultPageRewrites = new List <IDefaultPageRewrite> { mockDefaultPageRewrite.Object }; configuration.Setup(x => x.CreateDefaultPageRewrites()).Returns(defaultPageRewrites); return(configuration.Object); }); }