Skip to content

Instantly share code, notes, and snippets.

@csainty
csainty / app.config
Created June 1, 2014 20:08
Glimpse Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core, Version=1.0.0, Culture=neutral"/>
</configSections>
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<logging level="Trace"/>
<runtimePolicies>
<ignoredTypes>
<add type="Glimpse.Core.Policy.ControlCookiePolicy, Glimpse.Core"/>
@csainty
csainty / gist:6536769
Last active December 22, 2015 21:59 — forked from jchannon/gist:6536653
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnString"].ConnectionString))
{
var parameters = model.Keywords.Select((keyword, index) => new { Name = "@P" + index, Value = keyword });
var sql = String.Format("SELECT * FROM Table WHERE Id IN ({0})", String.Join(",", parameters.Select(x => x.Name)));
connection.Open();
using (var command = new SqlCommand(sql))
{
foreach (var p in parameters)
{
[AsyncStateMachine(typeof (Class1.<ExecuteAsync>d__0))]
[DebuggerStepThrough]
public Task ExecuteAsync()
{
Class1.<ExecuteAsync>d__0 stateMachine;
stateMachine.<>4__this = this;
stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create();
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start<Class1.<ExecuteAsync>d__0>(ref stateMachine);
return stateMachine.<>t__builder.Task;
public class AsyncCommand1 : IAsyncCommand
{
public Task ExecuteAsync()
{
int x = 2 + 2;
return Task.FromResult(true);
}
}
public class AsyncCommand2 : IAsyncCommand
public interface IAsyncCommand
{
Task ExecuteAsync();
}
public interface IQueries
{
Foo GetFoo(int fooId);
IEnumerable<Foo> QueryFooByBar(int barId);
}
public interface ICommands
{
void AddFooToBar(int barId, Foo foo);
}
public interface IsEmailAlreadyInUse
{
Task<bool> Execute(string emailAddress);
}
public interface CreateUser
{
Task Execute(string username, string email);
}
public interface IsEmailAlreadyInUse
{
Task<bool> Execute(string emailAddress);
}
internal class SqlRepository : IsEmailAlreadyInUse
{
Task<bool> IsEmailAlreadyInUse.Execute(string emailAddress)
{
// Implementation goes here
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using Xunit;
public class Fixture
{
[Fact]
public void Should_FactMethodName()
@csainty
csainty / Test.cs
Created May 18, 2012 12:08
Nancy Route Tests
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nancy;
using Nancy.Testing;
using Nancy.Testing.Fakes;
using Xunit;
using Xunit.Extensions;