public void GetAll_GivenThreeElementsFromDB_ShouldReturnAListWithThreeElements() { var repository = new SqlStudentRepository(); var result = repository.GetAll().ToList(); Assert.AreEqual(3, result.Count); }
public void Delete_GivenFourElementsFromDB_ShouldReturnAListWithThreeElements() { var repository = new SqlStudentRepository(); repository.DeleteById(4); var result = repository.GetAll(); Assert.AreEqual(3, result.Count()); }
public void ShouldOpenConnection() { var result = false; var repository = new SqlStudentRepository(); var openConnection = repository.GetAll(); if (openConnection != null) { result = true; } Assert.AreEqual(true, result); }
public void Update_GivenFourElementsFromDB_ShouldReturnAListWithFourElements() { var student = new Student { Id = 1, Guid = Guid.NewGuid(), Name = "Lola", LastName = "Perez", BirthDate = DateTime.Parse("31/07/1998") }; var repository = new SqlStudentRepository(); repository.Update(student); var result = repository.GetAll(); Assert.AreEqual(3, result.Count()); }
public void Create_GivenThreeElementsFromDB_ShouldReturnAListWithFourElements() { var student = new Student { Id = 4, Guid = Guid.NewGuid(), Name = "Nancy", LastName = "Jimenez", BirthDate = DateTime.Parse("31/07/1962") }; var repository = new SqlStudentRepository(); repository.Create(student); var result = repository.GetAll(); Assert.AreEqual(4, result.Count()); }