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
alias noyp="cd C:/SRC/NameOfYourProject/" # noyp is example abbreviation from NameOfYourProject | |
alias blef="cd C:/Work/Github/Blef/" | |
alias brlocal="git br | grep local" |
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 Newtonsoft.Json; | |
using Xunit; | |
[Fact] | |
public void SerializationTest() | |
{ | |
var money = Money.Create(1, "USD"); | |
string json = JsonConvert.SerializeObject(money); | |
Money result = JsonConvert.DeserializeObject<Money>(json); |
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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class CollectionExtensions | |
{ | |
public static void RemoveAll<T>(this ICollection<T> @this, Func<T, bool> predicate) | |
{ | |
List<T> list = @this as List<T>; |
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
# Auto detect text files and perform LF normalization: http://stackoverflow.com/questions/170961/whats-the-best-crlf-carriage-return-line-feed-handling-strategy-with-git/10855862#10855862 | |
* text=auto | |
*.sql diff | |
*.ts diff | |
*.xml diff |
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 System; | |
using System.Diagnostics.CodeAnalysis; | |
public struct Option<T> : IEquatable<Option<T>> | |
{ | |
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] | |
public static readonly Option<T> None = new Option<T>(); | |
private readonly T _value; | |
private readonly bool _hasValue; |
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 System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
public static class EitherExtensions | |
{ | |
[DebuggerStepThrough] | |
public static Either<TNew, TFailure> IfSuccess<TCurrent, TNew, TFailure>(this Either<TCurrent, TFailure> either, Func<TCurrent, Either<TNew, TFailure>> continuation) | |
{ | |
if (!either.Succeeded) |
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 System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
public static class OptionExtensions | |
{ | |
public static Either<TSuccess, TFailure> ToEither<TSuccess, TFailure>(this Option<TSuccess> option, TFailure failureValue) | |
{ | |
if (option.HasValue) | |
return new Either<TSuccess, TFailure>(option.Value); |
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> | |
/// Class should be used only by AutoFixture. Used for integration database tests, when we want to avoid Id clashes with current DB entities. | |
/// It sets long value, but every time we retrieve it we get negative value. | |
/// <remarks> | |
/// Class should be used only by <see cref="Fixture"/>, either directly by Create() method or by <see cref="AutoDataAttribute"/>. | |
/// </remarks> | |
/// </summary> | |
/// <example> | |
/// This sample shows how to use the <see cref="NegativeLongId"/> class | |
/// <code> |
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 AutoMapperExtensions | |
{ | |
/// <summary> | |
/// Maps properties as ignored. | |
/// </summary> | |
public static IMappingExpression<TSource, TDestination> Ignore<TSource, TDestination>( | |
this IMappingExpression<TSource, TDestination> map, | |
Expression<Func<TDestination, object>> selector) | |
{ | |
map.ForMember(selector, config => config.Ignore()); |
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 IQueryableExtensions | |
{ | |
public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>( | |
this IQueryable<TSource> source, | |
Expression<Func<TSource, TKey>> keySelector, | |
bool isAscending) | |
{ | |
if (isAscending) | |
{ | |
return source.OrderBy(keySelector); |