Created
April 15, 2018 17:18
-
-
Save pjwelcome/be42b505900b133c59cfa5996cc6545f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
override func setUp() { | |
super.setUp() | |
Resolver.reset() | |
DepedencyContainer.instance.register(depedency: ProductsRepository.self, implemenation: { | |
MockProductsRepository() | |
}) | |
} | |
func testGivenAProductTheProductsPriceWillBeFiveHundred() { | |
let expectedPrice = 100.0 | |
let viewModel = ProductViewModel() | |
XCTAssertTrue(viewModel.products.fetchProducts().first?.price == expectedPrice) | |
} | |
struct MockProductsRepository : ProductsRepository { | |
func fetchProducts() -> [Product] { | |
return [Product(name: "Adidas Sneakers", price: 100.0)] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment