-
-
Save davidalpert/1063997 to your computer and use it in GitHub Desktop.
depositor specification
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 fact when_withdrawing_money_from_empty_account = new SutSpecification<Depositor> | |
{ | |
Given = () => new Depositor(13), | |
When = depositor => depositor.Withdraw(50.00m), | |
Expect = | |
{ | |
depositor => depositor.Balance > 0.01m, | |
depositor => depositor.AccountIsOpen | |
}, | |
}; | |
} | |
public fact {} | |
public SutSpecification<T> : fact {} | |
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