Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created December 3, 2017 12:31
Show Gist options
  • Save azamsharp/c8e96e206d1000db28798ca1d5b96340 to your computer and use it in GitHub Desktop.
Save azamsharp/c8e96e206d1000db28798ca1d5b96340 to your computer and use it in GitHub Desktop.
Saving Data
class When_Trying_To_Save_User : XCTestCase {
private var dataAccess :DataAccess!
override func setUp() {
super.setUp()
self.dataAccess = DataAccess()
}
func test_should_save_user_successfully() {
let user = User(username :"johndoe", password: "password")
_ = self.dataAccess.saveUser(user)
// You can also get the user and compare the values of the username and password properties
XCTAssertTrue(self.dataAccess.getUsers().count == 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment