Ejemplo n.º 1
0
        public void CreateLog_CreatesNewLog()
        {
            var init = _context.Logs.Count();

            var student        = _context.Students.SingleOrDefault(x => x.FirstName == "Aaron");
            var initForStudent = _context.Logs.Count(x => x.StudentId == student.Id);

            Assert.IsNotNull(student);

            var newLog = new Log
            {
                Date = DateTime.Now, Message = "CreateLog", TypeId = 1, AuthorId = 1, StudentId = student.Id
            };

            _controller.CreateLog((newLog));

            var result = _context.Logs.Count();

            var result2 = _context.Logs.Count(x => x.StudentId == student.Id);

            Assert.AreEqual(init + 1, result);
            Assert.AreEqual(initForStudent + 1, result2);
        }