Skip to content

Instantly share code, notes, and snippets.

class test
initialize: ->
$('.button').click ->
method
method: -> alert 'test'
/*db.Blogs
.Include("Posts")
.Include("Posts.Comments")
.Where(x => x.Id == 1)
.ToList();*/
SELECT [Project2].[Id] AS [Id],
@SlyNet
SlyNet / gist:1063732
Created July 4, 2011 18:10
Faking the repository
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);
}
}
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);
}
}