Skip to content

Instantly share code, notes, and snippets.

View bsommardahl's full-sized avatar

Byron Sommardahl bsommardahl

View GitHub Profile
@bsommardahl
bsommardahl / gist:2701783
Created May 15, 2012 13:28
EndOfHeatTimeCalculator
public class EndOfHeatTimeCalculator : IEndOfHeatTimeCalculator
{
readonly ILastTappedHeatFetcher _lastTappedHeatFetcher;
public EndOfHeatTimeCalculator(ILastTappedHeatFetcher lastTappedHeatFetcher)
{
_lastTappedHeatFetcher = lastTappedHeatFetcher;
}
#region IEndOfHeatTimeCalculator Members
@bsommardahl
bsommardahl / gist:2701819
Created May 15, 2012 13:33
TapTimeCalculator
public class TapTimeCalculator : ITapTimeCalculator
{
readonly ILastTappedHeatFetcher _lastTappedHeatFetcher;
public TapTimeCalculator(ILastTappedHeatFetcher lastTappedHeatFetcher)
{
_lastTappedHeatFetcher = lastTappedHeatFetcher;
}
#region ITapTimeCalculator Members
@bsommardahl
bsommardahl / gist:2701863
Created May 15, 2012 13:40
EAFPowerCalculator
public class EAFPowerCalculator : IEAFPowerCalculator
{
#region IEAFPowerCalculator Members
public Megawatts Calculate(Megawatts eafPowerRate, Minutes extraDelay, Minutes secondCharge, Minutes powerOn)
{
var delay = extraDelay + secondCharge + powerOn;
double delayRate = (60 - Convert.ToDouble(delay.Value))/60;
double power = eafPowerRate.Value*delayRate;
return new Megawatts(power);
@bsommardahl
bsommardahl / gist:3290526
Created August 7, 2012 23:28
When a plumber fixes a sink... to fail
namespace RentAPlumber.Specs
{
public class when_a_plumber_fixes_a_sink
{
static Plumber _plumber;
static Sink _sink;
Establish context = () =>
{
_plumber = new Plumber();
@bsommardahl
bsommardahl / gist:3290566
Created August 7, 2012 23:35
Fixed the leaks...
public class Plumber
{
public void FixSink(Sink sink)
{
sink.Leaks.Clear();
}
}
@bsommardahl
bsommardahl / gist:3290592
Created August 7, 2012 23:41
The crack is not showing quite yet...
namespace RentAPlumber.Specs
{
public class when_a_plumber_fixes_a_sink
{
static Plumber _plumber;
static Sink _sink;
Establish context = () =>
{
_plumber = new Plumber();
@bsommardahl
bsommardahl / gist:3290625
Created August 7, 2012 23:47
A real plumber.
public class Plumber
{
public bool CrackShowing { get; private set; }
public void FixSink(Sink sink)
{
sink.Leaks.Clear();
CrackShowing = true;
}
}
@bsommardahl
bsommardahl / gist:3290657
Created August 7, 2012 23:52
Plumber fails to leave trash
public class when_a_plumber_fixes_a_sink
{
static Plumber _plumber;
static Sink _sink;
Establish context = () =>
{
_plumber = new Plumber();
_sink = new Sink
{
@bsommardahl
bsommardahl / gist:3290661
Created August 7, 2012 23:53
Plumber should leave trash on the floor
public class Floor
{
public List<Trash> Trash { get; set; }
}
public class Trash
{
}
public class Sink
@bsommardahl
bsommardahl / gist:3290688
Created August 7, 2012 23:56
A complete plumber
public class Plumber
{
public bool CrackShowing { get; private set; }
public void FixSink(Sink sink)
{
sink.Leaks.Clear();
CrackShowing = true;
sink.Floor.Trash.Add(new Trash());
}