-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuying_and_selling_stocks.feature
70 lines (63 loc) · 2.2 KB
/
buying_and_selling_stocks.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Feature: Buying and Selling Stocks
Scenario: Buying stocks.
Given The user has 120 dollars in cash-balance.
And IBM price is 30 dollars.
And The user has no IBM stocks.
When The user buys 1 IBM.
Then The user now has 1 IBM.
And The cash-balance is now 90 dollars.
Scenario: Buying stocks.
Given The user has 120 dollars in cash-balance.
And IBM price is 30 dollars.
And The user has no IBM stocks.
When The user buys 1 IBM.
Then The user now has 1 IBM.
And The cash-balance is now 90 dollars.
Scenario: Selling stocks.
Given The user has 120 dollars in cash-balance.
And The current stock prices are as such:
| Ticker | Price |
| AAPL | 50.25 |
| IBM | 30.0 |
| GOOG | 60.75 |
And The user Portfolio contains:
| Ticker | Quantity |
| AAPL | 5 |
| IBM | 3 |
| GOOG | 12 |
When The user sells 1 IBM.
Then The user now has 2 IBM.
And AAPL is still 5, and GOOG is still 12.
And The cash-balance is now 150 dollars.
Scenario: Selling stocks.
Given The user has 120 dollars in cash-balance.
And The current stock prices are as such:
| Ticker | Price |
| AAPL | 50.25 |
| IBM | 30.0 |
| GOOG | 60.75 |
And The user Portfolio contains:
| Ticker | Quantity |
| AAPL | 5 |
| IBM | 3 |
| GOOG | 12 |
When The user sells 1 IBM.
Then The user now has 2 IBM.
And AAPL is still 5, and GOOG is still 12.
And The cash-balance is now 150 dollars.
Scenario: Selling stocks you don’t have.
Given The user has 120 dollars in cash-balance.
And IBM price is 30 dollars.
And The user has no IBM stocks.
When The user sells 1 IBM.
Then We get an error.
And The user continues to have 0 IBM.
And The cash-balance continues to be 120 dollars.
Scenario: Selling stocks you don’t have.
Given The user has 120 dollars in cash-balance.
And IBM price is 30 dollars.
And The user has no IBM stocks.
When The user sells 1 IBM.
Then We get an error.
And The user continues to have 0 IBM.
And The cash-balance continues to be 120 dollars.