Skip to content

Instantly share code, notes, and snippets.

@vkhorikov
vkhorikov / 1.cs
Created July 2, 2019 02:47
Decorators for both commands and queries
public sealed class DatabaseCommandRetryDecorator<TCommand> : DatabaseRetryDecorator, ICommandHandler<TCommand>
where TCommand : ICommand
{
private readonly ICommandHandler<TCommand> _handler;
public DatabaseCommandRetryDecorator(ICommandHandler<TCommand> handler, Config config)
: base(config)
{
_handler = handler;
}
@vkhorikov
vkhorikov / 1.cs
Last active August 22, 2019 12:27
You are naming your tests wrong
[MethodUnderTest]_[Scenario]_[ExpectedResult]
@vkhorikov
vkhorikov / EnumerationSample.cs
Created December 22, 2020 13:07
A sample implementation of the Enumeration pattern
public abstract class PoolType : ValueObject
{
public static readonly PoolType Quant = new QuantPoolType();
public static readonly PoolType Verbal = new VerbalPoolType();
public static readonly PoolType IR = new IRPoolType();
public static readonly PoolType Awa = new AwaPoolType();
public static readonly PoolType[] AllTypes = { Quant, Verbal, IR, Awa };
public abstract int Id { get; }
public abstract int Size { get; }