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
[Test] | |
public void Structure_map_should_use_the_last_in_configuration_for_a_type() | |
{ | |
var container = new Container(config => config.ForRequestedType<ILogger>().TheDefaultIsConcreteType<NullLogger>()); | |
container.GetInstance<UsesLogging>().Logger.ShouldBeOfType<NullLogger>(); | |
container.Configure(config => config.ForRequestedType<ILogger>().TheDefault.Is.ConstructedBy(s=>new Log4NetLogger(s.ParentType))); | |
container.GetInstance<UsesLogging>().Logger.ShouldBeOfType<Log4NetLogger>(); |
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
//Here is some code that assumes you have references to the Dovetail SDK assemblies. | |
//First off here is what needs to be in the app settings part of the web.config file. | |
<appSettings> | |
<!-- Settings from the Configuring fcSDK documentation --> | |
<add key="fchoice.connectionstring" value="connectionstring"/> | |
<add key="fchoice.dbtype" value="mssql"/> | |
<add key="fchoice.disableloginfromfcapp" value="false"/> | |
<add key="fchoice.nocachefile" value="true"/> |
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 SolutionMap : DataMap<Solution> | |
{ | |
protected override void MapDefinition() | |
{ | |
FromTable("probdesc") | |
.Assign(d => d.ID).FromIdentifyingField("id_number") | |
.Assign(d => d.Title).FromField("title") | |
.Assign(d => d.Created).FromField("creation_time") | |
.Assign(d => d.DatabaseIdentifier).FromField("objid") | |
.Assign(d => d.MultiField).FromFields("objid", "title") |
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 SolutionMap : DataMap<Solution> | |
{ | |
protected override void MapDefinition() | |
{ | |
FromTable("probdesc") | |
.Assign(d => d.ID).FromIdentifyingField("id_number") | |
.Assign(d => d.Title).FromField("title") | |
.Assign(d => d.Created).FromField("creation_time") | |
.Assign(d => d.DatabaseIdentifier).FromField("objid") | |
.Assign(d => d.MultiField).FromFields("objid", "title") |
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
try | |
{ | |
using (var pop3 = CreatePop3Connection(account)) | |
{ | |
_logger.LogDebug("Mailbox has {0} new messages.", pop3.InboxMessageCount); | |
foreach (MailMessage mailMessage in pop3.DownloadEntireMessages()) | |
{ | |
_logger.LogDebug("Email received from {0} with id {1}", mailMessage.From.Email, mailMessage.MessageID); |
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.Web.Script.Serialization; | |
// ^^^ for this namespace ^^^ add a reference to System.Web.Extensions | |
public static class StringExtentensions | |
{ | |
public static string ToJson(this object objectToSerialize) | |
{ | |
return new JavaScriptSerializer().Serialize(objectToSerialize); | |
} |
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
Dear Winner! | |
We are pleased to notify you that your email address won the sum of GBP£1.5M (One Million Five Hundred Thousand British Pounds) from our monthly MSN/AOL Online Sweepstake Promotion held this year 2009 | |
Wherein your Email Address emerged as one of our online winning cash award of GBP£1.5M (One Million Five Hundred Thousand British Pounds) and your file falls within our European Claim Office in London. | |
You are advised to contact the processing officer immediately upon the receipt of this message for more information concerning the claim, processing and eventual payment of the above prize to you. | |
Contact Mr. John More of Trust Delivery Service for further details: | |
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 RetryingConsumerOfAll<TMessage> : Consumes<TMessage>.All where TMessage : class | |
{ | |
protected RetryingConsumerOfAll(Scheduler scheduler) | |
{ | |
Scheduler = scheduler; | |
} | |
private int _maximumNumberOfRetries = 5; | |
public int MaximumNumberOfRetries |
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
var concreteIRuleOfMessageType = container.Model.InstancesOf(typeof(IRule<MESSAGE>)).FirstOrDefault().ConcreteType; | |
var concreteIRuleSetOfMessageType = container.Model.InstancesOf(typeof(IRuleSet<MESSAGE>)).FirstOrDefault().ConcreteType; | |
var ruleInstances = new SmartInstance<IRule<MESSAGE>[]>().TheArrayOf<IRule<MESSAGE>>("rules") | |
.Contains(rule => | |
{ | |
foreach (var ruleExpresion in ruleSetExpression.Rules) | |
{ | |
var localRuleExpression = ruleExpresion; | |
rule.Instance( |
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 Context<T> where T : class | |
{ | |
[SetUp] | |
public void Setup() | |
{ | |
_services = new RhinoAutoMocker<T>(MockMode.AAA); | |
OverrideMocks(); | |
_cut = _services.ClassUnderTest; |
OlderNewer