Last active
May 3, 2019 17:24
-
-
Save SURYAKANTSHARMA/63644aacadd351bfa70d191428071d90 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
class MockUserDefault: UserDefaults { | |
var balance = Double() | |
override func set(_ value: Double, forKey defaultName: String) { | |
balance = value | |
} | |
} | |
func testUserBalanceCalculation() { | |
let user = User(balance: 100) | |
let mockUserDefaults = MockUserDefault() | |
saveUserBalance(user: user, buyingAmount: 50, defaults: mockUserDefaults) | |
XCTAssertTrue(mockUserDefaults.balance == 50) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment