class VendingMachine { int currentMoney ; public void insertCoin(int money) { currentMoney = money ; } public int getCurrentMoney() { return currentMoney ; } }
public class VendingMachine { int currentMoney ; public void insertCoin(int money) { currentMoney = money ; } public int getCurrentMoney() { return currentMoney ; } } 10ʮ͓ۚΛԁೖΕͨޙʹɺԁΛೖΕͨΒɺ ͪΌΜͱԁʹͳΔΑ͏ʹͯ͠΄͍͠ͳʯ
Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ public class VendingMachine { int currentMoney ; public void insertCoin(int money) { currentMoney = money ; } public int getCurrentMoney() { return currentMoney ; } }
Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ public class VendingMachine { int currentMoney = 0 ; public void insertCoin(int money) { currentMoney += money ; } public int getCurrentMoney() { return currentMoney ; } }
Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ public class VendingMachine { int currentMoney = 0 ; public void insertCoin(int money) { currentMoney += money ; } public int getCurrentMoney() { return currentMoney ; } } 10ʮ̍ԁߗ՟ରԠͨ͘͠ͳ͍ͳʯ
Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario:ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ public class VendingMachine { int currentMoney = 0 ; public void insertCoin(int money) { currentMoney += money ; } public int getCurrentMoney() { return currentMoney ; } }
Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ public class VendingMachine { int currentMoney = 0 ; public void insertCoin(int money) { if (money == 50 || money==100) { currentMoney += money ; } } public int getCurrentMoney() { return currentMoney ; } }
ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ͯ͢γφϦΦ໊͕ ʰೖֹۚ֬ೝʱʹͳͬͯ·͢ΑͶɻ ಉ໊͡લͲ͏͔ͱࢥ͏ͷͰ ม͑ͨ΄͏͕ྑ͍ؾ͕ͯ͠·͢ɻ ͳΔ΄Ͳɻ ͦͨ͠Β͜Μͳײ͡Ͱ͔͢Ͷɻ ʢςετγφϦΦΛฤू͢Δʣ ࢲ ։ൃऀ
Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ͯ͢γφϦΦ໊͕ ʰೖֹۚ֬ೝʱʹͳͬͯ·͢ΑͶɻ ಉ໊͡લͲ͏͔ͱࢥ͏ͷͰ ม͑ͨ΄͏͕ྑ͍ؾ͕ͯ͠·͢ɻ ͳΔ΄Ͳɻ ͦͨ͠Β͜Μͳײ͡Ͱ͔͢Ͷɻ ʢςετγφϦΦΛฤू͢Δʣ ։ൃऀͱͷձ(1) ࢲ ։ൃऀ
֬ೝ͍ͨ͠ͱ͍͏ҙਤͰ͢ɻ Scenario: 1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 2ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ࢲ ։ൃऀ
Ճࢉ͞Ε͍ͯ͘ΈͳͷͰɺ ϩδοΫ্େৎͰ͢ɻ Scenario: 1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 2ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ࢲ ։ൃऀ
1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 2ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ࢲ ։ൃऀ
1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ෳճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ࢲ ։ൃऀ
ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ೖֹۚ֬ೝ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 2ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: 1ճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ Then 100ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ෳճͷίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 100ԁΛೖۚ And 50ԁΛೖۚ Then 150ԁ͕ೖۚ͞Ε͍ͯΔ Scenario: ͑ͳ͍ίΠϯೖ Given ࣗಈൢചػ͕͋Δ When 1ԁΛೖۚ Then 0ԁ͕ೖۚ͞Ε͍ͯΔ ޙɺݟͨ࣌͠ʹ ςετͷҙਤ͕ΑΓΘΔͷͲΕʁ