Skip to content

Instantly share code, notes, and snippets.

View mattflo's full-sized avatar

Matt Florence mattflo

View GitHub Profile
@mattflo
mattflo / describe_Objectify.cs
Created October 21, 2011 04:29
Objectifying Xml using dynamic
using System.Dynamic;
using System.Linq;
using System.Xml.Linq;
using NSpec;
class describe_Objectify : nspec
{
dynamic kitten;
string markup;
@mattflo
mattflo / SuperMarketKata.cs
Created September 29, 2011 00:34
Supermarket Kata
using System.Linq;
using NSpec;
namespace SuperMarketKata
{
class describe_Checkout : nspec
{
void given_a_an_empty_sku_list()
{
specify = () => Checkout("").Is(0);
@mattflo
mattflo / StubHubKata
Created July 28, 2011 23:10
Stub Hub Kata
* Customers can reserve seats and obtain a ticket
* Seats are only allocated to one customer
* Seats are assigned to a section/row/seat number
* Seats can be searched in blocks (consecutive adjacent seats)
* Sections vary in price
* Seats can be searched by price range
* Seats can be searched by price and number of adjacent seats
@mattflo
mattflo / MapKata.txt
Created June 28, 2011 18:08
Map Kata
Map Kata
========
* Given a simple grid, e.g. 10x10
* Given a game piece is placed somewhere on the grid, e.g. 5,5
* Given the piece canNOT be moved diagonally, e.g. one up, one left...
* Find all available squares to which the piece can move
** 1 move
** 2 moves
** etc...
** until you are thrilled with your solution or ready for something new
@mattflo
mattflo / gist:1001458
Created May 31, 2011 22:57
Vending Machine Kata

“Requirements” – Order not important.

  • Stock items
  • Display stock with location codes and prices.
  • Accepts money
  • Only vend if the item is in stock and enough money has been inserted
  • Make change (money)
using NSpec;
using NSpec.Domain;
namespace SampleSpecs.Demo
{
class describe_explicit_examples : nspec
{
void hey_there()
{
specify = () => "one way".should_be("one way");
@mattflo
mattflo / describe_VendingMachine.cs
Created May 24, 2011 00:51
The outcomes of my repeated vending machine kata adventures
using System;
using System.Collections.Generic;
using NSpec;
namespace VendingMachineKata
{
class describe_VendingMachine : nspec
{
VendingMachine machine;
string firstSnickersVend;
using System;
using Castle.Core.Logging;
using System.Collections.Generic;
using NSpec;
using NSubstitute;
namespace Mephisto.Services
{
class describe_FileTransformer : nspec
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using CodeSlice.UnitTesting.Model;
using NSpec;
namespace CodeSlice.UnitTesting.NSpec
{
class describe_Vote : nspec
{
@mattflo
mattflo / DataMunger.iced
Last active August 29, 2015 13:56
DataMunger.iced
# The data munging kata - http://codekata.com/kata/kata04-data-munging/
fs = require("fs")
readline = require("readline")
footballParseJob =
file: "./football.dat"
max_column: 6
min_column: 8
id: 1