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 myApp = angular.module('myApp',[]); | |
myApp.controller('FooController', ['$scope', 'fooService', function($scope, fooService) { | |
var instance = this; | |
$scope.loadingStatus = 'none'; | |
instance.onBarCompleted = function(){ | |
$scope.loadingStatus = 'completed'; | |
}; |
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 mockFooService, | |
sut; | |
describe('FooController tests', function () { | |
beforeEach(function($q, $controller){ | |
mockFooService = { | |
bar: function() { | |
return $q.reject({ data: { message: 'Error message' } }); | |
} |
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 FakeAsyncCursor<TEntity> : IAsyncCursor<TEntity> | |
{ | |
private readonly IEnumerable<TEntity> _items; | |
public FakeAsyncCursor(IEnumerable<TEntity> items) | |
{ | |
_items = items ?? Enumerable.Empty<TEntity>(); | |
} | |
public IEnumerable<TEntity> Current |
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 interface IRepository<TEntity> | |
{ | |
string CollectionName { get; } | |
Task<long> CountAsync(FilterDefinition<TEntity> filter); | |
IFindFluent<TEntity, TEntity> Find(FilterDefinition<TEntity> filter); | |
IFindFluent<TEntity, TEntity> Find(Expression<Func<TEntity, bool>> filter); | |
Task<TEntity> FindOneAndReplaceAsync(FilterDefinition<TEntity> filter, TEntity replacement); | |
Task<TEntity> FindOneAndReplaceAsync(Expression<Func<TEntity, bool>> filter, TEntity replacement); | |
} |
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 interface IDbContext | |
{ | |
IRepository<Entities.Post> Posts { get; } | |
IRepository<Entities.User> Users { get; } | |
IRepository<Entities.Tag> Tags { get; } | |
IRepository<Entities.Taxonomy> Taxonomies { get; } | |
} |
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 interface IRepositoryFactory | |
{ | |
IRepository<TEntity> Create<TEntity>(RepositoryOptions options); | |
} |
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 interface IMongoDatabaseFactory | |
{ | |
IMongoDatabase Connect(string connectionString, string dbName); | |
} |
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 abstract class BaseCommandHandler<TCommand> : IAsyncNotificationHandler<TCommand> | |
{ | |
private readonly IValidator<TCommand> _validator; | |
protected BaseCommandHandler(IValidator<TCommand> validator = null) | |
{ | |
_validator = validator; | |
} | |
public async Task Handle(TCommand command) |
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 MongoDatabaseFactory : IMongoDatabaseFactory | |
{ | |
public IMongoDatabase Connect(string connectionString, string dbName) | |
{ | |
if(string.IsNullOrWhiteSpace(connectionString)) | |
throw new ArgumentNullException("connectionString"); | |
if (string.IsNullOrWhiteSpace(dbName)) | |
throw new ArgumentNullException("dbName"); | |
var dbClient = new MongoClient(connectionString); |
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 my_shortcode{ | |
public function __construct() | |
{ | |
add_shortcode('my_shortcode', array($this, 'render_form')); | |
add_action( 'template_redirect', array($this, 'handle_form_post') ); | |
} | |
function render_form(){ |