Skip to content

Instantly share code, notes, and snippets.

namespace Yarrrr
{
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Pirate dictionary be plundered from Davie Reed ( http://nifty.stanford.edu/2004/TalkLikeAPirate/pirate3.html )
/// Yarrr!
/// </summary>
@grumpydev
grumpydev / VerySecureModule.cs
Created February 23, 2011 19:26
NancyFx claims based authentication demo module.
namespace NancyAuthenticationDemo
{
using Extensions;
using Models;
using Nancy;
/// <summary>
/// A module that only people with SuperSecure clearance are allowed to access
/// </summary>
public class VerySecureModule : NancyModule
namespace NancyConNegDemo
{
using Extensions;
using Models;
using Nancy;
public class ConNegModule : NancyModule
{
public ConNegModule() : base("/conneg")
{
namespace TinyTemplates.ViewEngine
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
namespace Nancy.BindingDemo
{
using System.Linq;
using Nancy.BindingDemo.Database;
using Nancy.BindingDemo.Models;
using Nancy.ModelBinding;
public class MainModule : NancyModule
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nancy;
using Simple.Data.Mocking;
using Simple.Data;
using System.IO;
using System.Reflection;
using System.Dynamic;
@grumpydev
grumpydev / AppDomainAssemblyTypeScanner.cs
Created March 12, 2011 18:43
Better type scanner for nancy that caches and also loads Nancy dlls into the app domain on startup (to work around the view engines not being detected in mspec tests)
namespace AppDomainTypeScanning
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
/// <summary>
/// Scans the app domain for assemblies and types
namespace Nancy
{
using System.IO;
public class RequestStream : MemoryStream
{
private bool disableThresholdSwitching;
private int thesholdLength;
protected static int ThreshHoldLength { get; set; }
public class RequestStream : Stream
{
private Stream stream;
private readonly long expectedLength;
private readonly long threshHoldLength;
private readonly bool disableStreamSwapping;
public RequestStream(long expectedLength, long threshHoldLength, bool disableStreamSwapping)
: this(null, expectedLength, threshHoldLength, disableStreamSwapping)
{
[SkippableFact]
public void Should_set_query_string_and_uri_correctly()
{
Request nancyRequest = null;
var fakeEngine = A.Fake<INancyEngine>();
A.CallTo(() => fakeEngine.HandleRequest(A<Request>.Ignored))
.Invokes((f) => nancyRequest = (Request)f.Arguments[0]);
var fakeBootstrapper = A.Fake<INancyBootstrapper>();
A.CallTo(() => fakeBootstrapper.GetEngine()).Returns(fakeEngine);