This file contains 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 static bool IsUnitTest | |
{ | |
get | |
{ | |
FileInfo fileInfo = new FileInfo(Process.GetCurrentProcess().MainModule.FileName); | |
return fileInfo.Name.StartsWith("vstesthost", StringComparison.OrdinalIgnoreCase) || fileInfo.Name.StartsWith("mstest", StringComparison.OrdinalIgnoreCase); | |
} | |
} |
This file contains 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 static class RepositoryFakes | |
{ | |
public static IRepository<T> AsRepository<T>(this IList<T> list) where T : Entity | |
{ | |
IQueryable<T> queryable = list.AsQueryable(); | |
return Mock.Of<IRepository<T>>(x => x.Expression == queryable.Expression | |
&& x.ElementType == queryable.ElementType | |
&& x.Provider == queryable.Provider); | |
} | |
} |
This file contains 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
/*db.Blogs | |
.Include("Posts") | |
.Include("Posts.Comments") | |
.Where(x => x.Id == 1) | |
.ToList();*/ | |
SELECT [Project2].[Id] AS [Id], |
This file contains 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
class test | |
initialize: -> | |
$('.button').click -> | |
method | |
method: -> alert 'test' |
This file contains 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, |
This file contains 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 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 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 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 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; |
OlderNewer