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 ILogger | |
{ | |
void Log(LogLevel level, string text); | |
} | |
public enum LogLevel | |
{ | |
Off = 0, | |
Trace, | |
Debug, |
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
/// https://stackoverflow.com/questions/25606730/get-current-locale-of-chrome#answer-42070353 | |
var language; | |
if (window.navigator.languages) { | |
language = window.navigator.languages[0]; | |
} else { | |
language = window.navigator.userLanguage || window.navigator.language; | |
} |
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
version: "2" | |
services: | |
wptest: | |
image: wordpress | |
ports: | |
- 8080:80 | |
depends_on: | |
- mysql | |
mysql: | |
image: mariadb |
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 Xunit; | |
using Moq; | |
public class UpdateUserHandlerTests | |
{ | |
[Fact] | |
public async Task should_Update_user_when_command_valid() | |
{ | |
var command = new UpdateUser(id: Guid.NewGuid(), firstname: "lorem", lastname: "ipsum"); |
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 Xunit; | |
using Moq; | |
public class CreateUserHandlerTests | |
{ | |
[Fact] | |
public async Task should_create_user_when_command_valid() | |
{ | |
var command = new CreateUser(id: Guid.NewGuid(), username: "loremipsum", email: "lorem@ipsum.com", firstname: "lorem", lastname:"ipsum"); |
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(){ |
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
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 class RepositoryFactory : IRepositoryFactory | |
{ | |
private readonly IMongoDatabaseFactory _dbFactory; | |
public RepositoryFactory(IMongoDatabaseFactory dbFactory) | |
{ | |
if (dbFactory == null) | |
throw new ArgumentNullException("dbFactory"); | |
_dbFactory = dbFactory; | |
} |