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
lang en_US | |
keyboard us | |
timezone America/New_York --isUtc | |
rootpw $1$1k1q3sJ8$UGYAVzcQodGKc0haFdxCZ1 --iscrypted | |
#platform x86, AMD64, or Intel EM64T | |
reboot | |
text | |
cdrom | |
bootloader --location=mbr --append="rhgb quiet crashkernel=auto" | |
zerombr |
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
#region DatabaseSetup | |
private TestContext _testContextInstance; | |
public TestContext TestContext | |
{ | |
get { return _testContextInstance; } | |
set { _testContextInstance = value; } | |
} | |
private IUnitOfWorkFactory _unitOfWorkFactory = null; |
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 IntegrationTestUnitOfWorkFactory : IUnitOfWorkFactory | |
{ | |
/// <summary> | |
/// This <see cref="Guid"/> is used to uniquely identify this factory instance when interacting with the LocalDB instance. | |
/// </summary> | |
private readonly Guid _instanceGuid = Guid.NewGuid(); | |
/// <summary> | |
/// The <see cref="TestContext"/> instance that describes the environment in which the tests are currently running. | |
/// This is used to get the deployment directory for where the LocalDB file should be stored. |
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> | |
/// A <see cref="SingleThreadedMongoDbLogRepository"/> is an implementation of the <see cref="ILogRepository"/> interface that | |
/// wraps an existing <see cref="ILogRepository"/>, but performs all of the write operations in a background thread, controlled | |
/// by the <see cref="MongoDbLoggerWriteThread"/>. | |
/// | |
/// This allows write operations to not impact on the calling code at all, ensuring the actual write is performed in the background. | |
/// </summary> | |
class SingleThreadedMongoDbLogRepository : ILogRepository | |
{ | |
private readonly MongoDbLoggerWriteThread _writer; |
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 ILogRepository | |
{ | |
void AddLog(string logger, LogEntry message); | |
void AddLog(string logger, KeyedLogEntry message); | |
IList<LogEntry> GetLog(string logger); | |
IList<KeyedLogEntry> GetLog(string logger, string key); | |
} |
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 LogEntry | |
{ | |
public Guid Id { get; set; } | |
public string Logger { get; set; } | |
public string Message { get; set; } | |
public DateTime Created { get; set; } | |
public static LogEntry Create(string Logger, string Message) | |
{ | |
LogEntry le = new LogEntry() |
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> | |
/// This writer thread attempts to serialize all writes to the MongoDB database in a background thread. | |
/// </summary> | |
public class MongoDbLoggerWriteThread | |
{ | |
/// <summary> | |
/// The lock object guarding access to the <see cref="_entries"/> and <see cref="_keyedEntries"/> lists. | |
/// </summary> | |
private static readonly object LOCK_OBJECT = new object(); |
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 KeyedLogEntry : LogEntry | |
{ | |
public string AdditionalKey { get; set; } | |
public static KeyedLogEntry Create(string Logger, string key, string Message) | |
{ | |
KeyedLogEntry entry = new KeyedLogEntry() | |
{ | |
AdditionalKey = key, | |
Created = DateTime.Now, |
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> | |
/// Simple interface that defines how instances of <see cref="IDistributedLog"/> can be created. | |
/// </summary> | |
public interface IDistributedLogFactory | |
{ | |
/// <summary> | |
/// Will return a cached <see cref="IDistributedLog"/> or return a new one if one does not exist in the cache. | |
/// </summary> | |
IDistributedLog GetLogger(string loggerName); | |
} |
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 WhiskeyServiceBuilder : IServiceBuilder<IWhiskeyService> | |
{ | |
private static WhiskeyServiceBuilder _instance; | |
public static WhiskeyServiceBuilder CreateDecoratedService(IServiceFactory factory, INotificationService n, IDistributedLogFactory logFactory, IWhiskeyService w) | |
{ | |
return _instance ?? (_instance = new WhiskeyServiceBuilder(factory, n, logFactory, w)); | |
} | |
private readonly INotificationService _notificationService; |
NewerOlder