예제 #1
0
        public void GetAll_GivenThreeElementsFromDB_ShouldReturnAListWithThreeElements()
        {
            var repository = new SqlStudentRepository();
            var result     = repository.GetAll().ToList();

            Assert.AreEqual(3, result.Count);
        }
예제 #2
0
        public void Delete_GivenFourElementsFromDB_ShouldReturnAListWithThreeElements()
        {
            var repository = new SqlStudentRepository();

            repository.DeleteById(4);
            var result = repository.GetAll();

            Assert.AreEqual(3, result.Count());
        }
예제 #3
0
        public void ShouldOpenConnection()
        {
            var result         = false;
            var repository     = new SqlStudentRepository();
            var openConnection = repository.GetAll();

            if (openConnection != null)
            {
                result = true;
            }
            Assert.AreEqual(true, result);
        }
예제 #4
0
        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());
        }
예제 #5
0
        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());
        }