This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDependencyResolver resolver = Mock.Of<IDependencyResolver>(x => x.GetService(typeof(IDictionaryService)) == dictionaryService&& | |
x.GetService(typeof(IDictionaryRepository)) == dictionaryRepository && | |
x.GetService(typeof(IMappingEngine)) == mappingEngine); | |
DependencyResolver.SetResolver(dependencyResolver); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFetchRequest<TQueried, TFetch> : IOrderedQueryable<TQueried> { } | |
public class FetchRequest<TQueried, TFetch> : IFetchRequest<TQueried, TFetch> | |
{ | |
public IEnumerator<TQueried> GetEnumerator() | |
{ | |
return NhFetchRequest.GetEnumerator(); | |
} | |
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Subject(typeof(AssetsHandler))] | |
public class When_compress_is_true_and_client_accepts_gzip : compression_spec | |
{ | |
Establish context = () => { | |
Compress = true; | |
AcceptEncoding = "gzip"; | |
}; | |
Because of = () => handler.ProcessRequest(httpContext.Object); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Establish context = () => { | |
var mocker = new AutoMoq.AutoMoqer(); | |
mocker.GetMock<ISettingsRepository>() | |
.Setup(x => x.GetCommon()) | |
.Returns(new AssetsOptimizerSection { Compress = true }); | |
handler = mocker.Resolve<AssetsHandler>(); | |
var request = new Mock<HttpRequestBase>(); | |
request.Setup(x => x.Headers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Machine.Specifications; | |
using Moq; | |
using It = Machine.Specifications.It; | |
namespace AssetsOptimizer.Specs.Web | |
{ | |
public class MockSpec | |
{ | |
static string test = "orig"; | |
static Mock<IDep> dependency; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Used for mocking utility method in unit tests. | |
/// </summary> | |
internal Func<string, string> ToAppRelative = (relativePath) => VirtualPathUtility.ToAppRelative(relativePath); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VirtualPathUtil | |
{ | |
public static Func<string, string> ToAppRelative = (relativePath) => VirtualPathUtility.ToAppRelative(relativePath); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rootPhysicalPath = context.Server.MapPath(settings.GetScriptsConfig().Path); | |
var jsPhysicalPath = Path.Combine(rootPhysicalPath, Path.GetFileName(jsFileName) + ".js"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Establish context = () => { | |
var settingsRepository = Mock.Of<ISettingsRepository>(); | |
var minificationProvider = Mock.Of<IMinificationProvider>(); | |
var pathProvider = Mock.Of<IAssetsPathProvider>(); | |
handler = new AssetsHandler(settingsRepository, minificationProvider, pathProvider); | |
request = new HttpRequest("file", "http://test.com", "js=jquery,main"); | |
responseStringBuilder = new StringBuilder(); | |
response = new HttpResponse(new StringWriter(responseStringBuilder)); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.downloadedContent = new Array(navigationApi.getItems().length) | |
if navigationApi.getItems().length > 3 | |
overviewNavigation.appendItemContent(navigationApi, i) for i in [1..3] | |
@appendItemContent: (api, itemIndex) => | |
url = @groupRenderUrl + @getItemUrl(api.getItems()[itemIndex]) | |
$.ajax { | |
url, | |
async: false, |