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 log4net; | |
using log4net.Appender; | |
using log4net.Core; | |
using log4net.Layout; | |
using log4net.Repository.Hierarchy; | |
public static class Logging | |
{ | |
private const string ConversionPattern = "%date{HH:mm:ss,fff} %-5level %-15logger{1} %message%newline"; | |
private static readonly PatternLayout PatternLayout; |
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 ExceptionAssert | |
{ | |
public static T Throws<T>(Action action) | |
where T : Exception | |
{ | |
try | |
{ | |
action(); | |
} | |
catch (T ex) |
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 FakeDbSet<T> : DbSet<T>, IQueryable | |
where T : class | |
{ | |
private readonly Func<T, object[], bool> _find; | |
readonly ObservableCollection<T> _items; | |
private IQueryable<T> _query; | |
public FakeDbSet(Func<T, object[], bool> find = null) | |
{ | |
_find = find; |
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
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="text" omit-xml-declaration="yes" /> | |
<xsl:template match="/"> | |
<xsl:call-template name="FizzBuzz"> | |
<xsl:with-param name="i" select="1" /> | |
</xsl:call-template> | |
</xsl:template> | |
<xsl:template name="FizzBuzz"> |
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 ObjectPool<T> | |
{ | |
private readonly Queue<T> _items = new Queue<T>(); | |
private readonly Queue<TaskCompletionSource<T>> _waits = new Queue<TaskCompletionSource<T>>(); | |
public void Add(T value) | |
{ | |
lock (_waits) | |
{ | |
if (_waits.TryDequeue(out var wait)) |