Skip to content

Instantly share code, notes, and snippets.

@gregoryyoung
Created July 4, 2011 21:33
Show Gist options
  • Save gregoryyoung/1063972 to your computer and use it in GitHub Desktop.
Save gregoryyoung/1063972 to your computer and use it in GitHub Desktop.
depositor specification
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Simple.Testing.Framework;
namespace Simple.Testing.Example
{
/*
* In a SUT specification the SUT is returned from the Given(). The SUT is then given
* as a parameter to the When and the Expects. It is expected that the when() will
* issue some behavior that mutates the SUT which is then sent to the expectations.
*/
public class DepositorSpecifications
{
public Specification when_withdrawing_money_from_empty_account = new SutSpecification<Depositor>
{
On = () => new Depositor(13),
When = depositor => depositor.Withdraw(50.00m),
Expect =
{
depositor => depositor.Balance > 0.01m,
depositor => depositor.AccountIsOpen
},
};
}
public class Depositor
{
public readonly decimal Balance;
public readonly bool AccountIsOpen;
public void Withdraw(decimal amount)
{
}
public Depositor(int depositorId)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment