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 serviceBroker = Substitute.For<IServiceBroker>(); | |
var paymentRequest = Substitute.For<IPaymentRequest>(); | |
var scenarioSteps = new ScenarioSteps(serviceBroker,paymentRequest); | |
var successfulSubmitPaymentArgs = new SubmitPaymentArgs(true); | |
serviceBroker.When((sb)=>sb.SubmitPayment(paymentRequest)).Do((sb)=>serviceBroker.ServiceBrokerEventHandler+= Raise.EventWith(serviceBroker, (PaymentEventArgs)successfulSubmitPaymentArgs)); | |
var creditDebitPurchaseScenario = new CreditDebitPurchaseScenario(serviceBroker, scenarioSteps, null); | |
creditDebitPurchaseScenario.MakePayment(paymentRequest); |
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
http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/harrybiscuit/a4d17f212057ed53b75f/raw/3d8f63d487e608fd045ea87452269170da007f3b/DevBoxTools |
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
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions | |
cinst notepadplusplus | |
cinst git | |
cinst gittfs | |
cinst console2 | |
cinst dotpeek | |
cinst sourcetree | |
cinst sysinternals | |
cinst linqpad |
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
// This is not my code but I put it here so I can remember where to get it when I need it. | |
//http://stackoverflow.com/questions/1563191/c-sharp-cleanest-way-to-write-retry-logic | |
public static class Retry | |
{ | |
public static void Do(Action action, TimeSpan retryInterval, int retryCount = 3) { | |
Do<object>(() => { | |
action(); | |
return null; | |
}, retryInterval, retryCount); | |
} |
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 ExceptionExtensions | |
{ | |
public static string UnwrapInnerExceptionMessages(this Exception exception) | |
{ | |
var sb = new StringBuilder(); | |
if (!string.IsNullOrWhiteSpace(exception.Message)) | |
{ | |
sb.AppendLine(exception.Message); | |
} |
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.Concurrent; | |
public interface IWorkflowApplicationMonitor | |
{ | |
bool IsRunning(Guid workflowDefinitionId); | |
void SetStatusToRunning(Guid workflowDefinitionId); | |
void SetStatusToNotRunning(Guid workflowDefinitionId); | |
} |
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 IEnumerable<XElement> GetMyThings(string sqlCommandReturningXml) | |
{ | |
var connectionString = ConnectionString();//You'll have to write this method. It should return a connection string. | |
using (var sqlConnection = new SqlConnection { ConnectionString = connectionString }) | |
{ | |
sqlConnection.Open(); | |
var cmd = SqlCommand(sqlCommandReturningXml, sqlConnection);//You'll have to write this method. It should return a SqlCommand object. | |
using (var reader = cmd.ExecuteXmlReader()) | |
{ |
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 MyController : Controller | |
{ | |
[HandleError(View ="MyCustomError",ExceptionType = typeof(MyException))] | |
public ActionResult MyAction(string SaleType) | |
{ | |
//Do stuff here that may throw an exception | |
// The following line will demonstrate what happens when an exception is thrown | |
throw new MyException("bang !"); | |
} |
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
<services> | |
<service behaviorConfiguration="InstanceControllerServiceBehavior" name="Services.InstanceControllerService.InstanceController"> | |
<endpoint name="netTcpEndpoint" binding="netTcpBinding" contract="Services.InstanceControllerService.IInstanceController" /> | |
<endpoint name="mexNetTcpEndpoint" address="net.tcp://my-server:41422/mex" binding="mexTcpBinding" contract="IMetadataExchange"/> | |
<host> | |
<baseAddresses> | |
</baseAddresses> | |
</host> | |
</service> | |
</services> |
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
[Subject("Viewing Secured Home Page")] | |
public class when_viewing_a_secured_homepage_with_no_auth_cookie | |
{ | |
private static HttpWebRequest request; | |
private static HttpWebResponse response; | |
private Establish context = () => | |
{ | |
request = HttpWebRequest.Create("http://localhost:53759/") as HttpWebRequest; | |
request.AllowAutoRedirect = false; |
NewerOlder