Skip to content

Instantly share code, notes, and snippets.

View smallgeek's full-sized avatar
🤔
Now thinking...

smallgeek smallgeek

🤔
Now thinking...
View GitHub Profile
@smallgeek
smallgeek / NaturalSpec_Tutorial_4_3.txt
Created August 26, 2012 07:03
NaturalSpec_Tutorial_4_3
Scenario: When selling a car for 30000 it should equal the DreamCar mocked
- As Bert
- With Mocking
- When selling a car for 30000
=> It should equal BMW (200 HP)
=> It should not equal Fiat (45 HP)
==> OK
@smallgeek
smallgeek / NaturalSpec_Tutorial_4_2.fs
Created August 26, 2012 07:02
NaturalSpec_Tutorial_4_2
// 1. モジュールを定義する
module CarSpec
// 2. NaturalSpec 名前空間を開く
open NaturalSpec
// 3. プロジェクトの名前空間を開く
open CarSellingLib
// 再利用可能な値を定義する
@smallgeek
smallgeek / NaturalSpec_Tutorial_4_1.cs
Created August 26, 2012 06:49
NaturalSpec_Tutorial_4_1
namespace CarSellingLib
{
public interface IDealer
{
Car SellCar(int amount);
}
}
@smallgeek
smallgeek / NaturalSpec_Tutorial_3_5.txt
Created August 26, 2012 06:24
NaturalSpec_Tutorial_3_5
Scenario: When selling a car for 1000 it should fail with Need More Money
- Should fail…
– As Bert
– When selling a car for 1000
Scenario: When selling a car for 19000 it should equal the LameCar
- As Bert
– When selling a car for 19000
@smallgeek
smallgeek / NaturalSpec_Tutorial_3_4.cs
Created August 26, 2012 06:21
NaturalSpec_Tutorial_3_4
namespace CarSellingLib
{
public enum CarType
{
Fiat,
BMW
}
}
namespace CarSellingLib
@smallgeek
smallgeek / NaturalSpec_Tutorial_3_3.fs
Created August 26, 2012 06:16
NaturalSpec_Tutorial_3_3
// 1. モジュールを定義する
module CarSpec
// 2. NaturalSpec 名前空間を開く
open NaturalSpec
// 3. プロジェクトの名前空間を開く
open CarSellingLib
// 4. テストコンテキストを定義する
@smallgeek
smallgeek / NaturalSpec_Tutorial_3_2.cs
Created August 26, 2012 06:10
NaturalSpec_Tutorial_3_2
namespace CarSellingLib
{
public enum CarType
{
BMW
}
}
namespace CarSellingLib
{
@smallgeek
smallgeek / NaturalSpec_Tutorial_3_1.fs
Created August 26, 2012 06:03
NaturalSpec_Tutorial_3_1
// 1. モジュールを定義する
module CarSpec
// 2. NaturalSpec 名前空間を開く
open NaturalSpec
// 3. プロジェクトの名前空間を開く
open CarSellingLib
// 4. テストコンテキストを定義する
@smallgeek
smallgeek / NaturalSpec_Tutorial_2_1.fs
Created August 26, 2012 05:57
NaturalSpec_Tutorial_2_1
module ListSpec
open NaturalSpec
[<Scenario>]
let When_removing_an_3_from_a_small_list_it_should_not_contain_3() =
Given [1;2;3;4;5]
|> When removing 3
|> It shouldn't contain 3
|> Verify
@smallgeek
smallgeek / NaturalSpec_Tutorial_1_4.txt
Created August 26, 2012 05:42
NaturalSpec_Tutorial_1_4
Scenario: When calculating fac 0 it should equal 0
- Given 0
– When calculating factorial
=> It should equal 1
==> OK
Scenario: When calculating fac 1 it should equal 1
- Given 1