Created
March 25, 2017 22:22
-
-
Save dsibinski/2cefa097384d3c5e33595f37392cc330 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
[Test] | |
public void one_new_person_inserted_adds_one_new_row() | |
{ | |
// given | |
var person = new Person() | |
{ | |
Name = "A", | |
LastName = "B" | |
}; | |
var repo = new Repository<Person>(InMemorySqliteConnection); | |
// when | |
var numRows = repo.Insert(person).Result; | |
// then | |
Assert.AreEqual(1, numRows); | |
} | |
[Test] | |
public void new_person_added_has_id_primarykey_generated() | |
{ | |
// given | |
var person1 = new Person | |
{ | |
Name = "A", | |
LastName = "B" | |
}; | |
var person2 = new Person | |
{ | |
Name = "A", | |
LastName = "B" | |
}; | |
var repo = new Repository<Person>(InMemorySqliteConnection); | |
// when | |
var n1 = repo.Insert(person1).Result; // getting Result in order to force Task's completion before continuing | |
var n2 = repo.Insert(person2).Result; | |
// then | |
Assert.Greater(person1.Id, 0); | |
Assert.AreEqual(person2.Id, person1.Id + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment