Created
September 25, 2014 09:31
-
-
Save AlexArchive/eb411d9dce77fcd36aad to your computer and use it in GitHub Desktop.
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
public class CheckoutTest | |
{ | |
[Fact] | |
public void PlaceOrder_ReturnsCorrectMessage() | |
{ | |
Checkout sut = new Checkout(); | |
string actual = sut.PlaceOrder("bfc"); | |
string expected = | |
"The order is\r\n" + | |
" burger: 1\r\n" + | |
" fries: 1\r\n" + | |
" coke: 1\r\n" + | |
" The cost is $8.88"; | |
Assert.Equal(expected, actual); | |
} | |
[Fact] | |
public void PlaceOrder_QuantitiySpecified_ReturnsCorrectMessage() | |
{ | |
Checkout sut = new Checkout(); | |
string actual = sut.PlaceOrder("2b3fc"); | |
string expected = | |
"The order is\r\n" + | |
" burger: 2\r\n" + | |
" fries: 3\r\n" + | |
" coke: 1\r\n" + | |
" The cost is $20.73"; | |
Assert.Equal(expected, actual); | |
} | |
[Fact] | |
public void PlaceOrder_NonExistentMenuItem_ReturnsCorrectMessage() | |
{ | |
Checkout sut = new Checkout(); | |
string actual = sut.PlaceOrder("wbwmwxyzk"); | |
string expected = | |
"Sorry, we don't serve x\r\n" + | |
"Sorry, we don't serve y\r\n" + | |
"Sorry, we don't serve z\r\n" + | |
"The order is\r\n" + | |
" wrap: 3\r\n" + | |
" burger: 1\r\n" + | |
" muffin: 1\r\n" + | |
" koffee: 1\r\n" + | |
" The cost is $21.25"; | |
Assert.Equal(expected, actual); | |
} | |
[Fact] | |
public void PlaceOrder_StockDepleted_OffersSuggestion() | |
{ | |
Checkout sut = new Checkout(); | |
sut.PlaceOrder("bbb"); | |
var actual = sut.PlaceOrder("b"); | |
string expected = | |
"We don't have enough wrap\r\n" + | |
"Would you like some burger?/"; | |
Assert.Equal(expected, actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment