Skip to content

Instantly share code, notes, and snippets.

View mitchdenny's full-sized avatar
💭
Currently setting my user status :)

Mitch Denny mitchdenny

💭
Currently setting my user status :)
View GitHub Profile
@mitchdenny
mitchdenny / ShortUrlTokenGenerator.cs
Created April 3, 2011 08:42
The purpose of this class is to generate a random short URL.
using System;
public static class ShortUrlTokenGenerator
{
private const string alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
private static Random generator = new Random();
public static string GenerateToken(int tokenLength)
{
var builder = new StringBuilder();
public class SubscriptionController : Controller
{
public SubscriptionController(ISubscriberRepository subscriberRepository, IObserver<SubscribedToNewsletter> subscribedToNewsletterObserver, IObserver<UnsubscribedFromNewsletter> unsubscribedFromNewsletterObserver)
{
SubscriberRepository = subscriberRepository;
SubscribedToNewsletterObserver = subscribedToNewsletterObserver;
UnsubscribedFromNewsletterObserver = unsubscribedFromNewsletterObserver;
}
}
@mitchdenny
mitchdenny / BasicCalculatorSpecification.cs
Created December 31, 2010 02:31
This is a specification for a basic calculator with the implementation rounded out.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSTestContrib.Specifications;
namespace Calculator.Core.Specifications
{
[TestClass]
[SpecificationDescription("As a user I want to perform mathematical calculations so that my head doesn't hurt.")]
public class BasicCalculatorSpecification : Specification
{
@mitchdenny
mitchdenny / BasicCalculatorSpecification.cs
Created December 31, 2010 02:15
This is a specification for a calculator with no implementation provided.
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSTestContrib.Specifications;
namespace Calculator.Core.Specifications
{
[TestClass]
[SpecificationDescription("As a user I want to perform mathematical calculations so that my head doesn't hurt.")]
public class BasicCalculatorSpecification : Specification
{