Created
May 3, 2019 18:08
-
-
Save SURYAKANTSHARMA/acc0bd99aa0012c3eedf4ab100dffa42 to your computer and use it in GitHub Desktop.
testCart
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
func testCart() { | |
let product = Product(name: "Macbook", price: 100) | |
var cart = Cart() | |
cart.products.append(product) | |
XCTAssertEqual(product.price, cart.totalPrice) | |
let coupon = Coupon(code: "SPECIAL20", percentage: 20) | |
cart.apply(coupon) | |
XCTAssertEqual(cart.totalPrice, 80) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment