public void GetAllStudentsTest()
        {
            var repository = Mock.Create<IRepository<Student>>();
            var studentToAdd = new Student()
            {
                FirstName = "Petko"
            };
            IList<Student> studentEntities = new List<Student>();
            studentEntities.Add(studentToAdd);
            Mock.Arrange(() => repository.All()).Returns(studentEntities.AsQueryable);

            var controller = new StudentsController(repository);

            var studentModels = controller.Get();
            Assert.IsTrue(studentModels.Count() == 1);
            Assert.AreEqual(studentToAdd.FirstName, studentModels.First().FirstName);
        }
        public void TestGetByIdStudent()
        {
            var repository = Mock.Create<IRepository<Student>>();
            var student = new Student()
            {
                StudentId = 1,
                FirstName = "Pesho",
                LastName = "Peshov",
                Grade = 3
            };

            Mock.Arrange<Student>(
                () => repository.Get(student.StudentId))
                .IgnoreArguments()
                .Returns(student)
                .MustBeCalled();

            var controller = new StudentsController(repository);
            SetupController(controller);
            var result = controller.Get(student.StudentId);

            Assert.AreEqual(result.StudentId, student.StudentId);
            Assert.AreEqual(result.FirstName, student.FirstName);
            Assert.AreEqual(result.LastName, student.LastName);
            Assert.AreEqual(result.Grade, student.Grade);
        }
        public void GetAllStudents_ReturnOnlyOneTest()
        {
            var repository = new FakeRepository<Student>();

            var studentToAdd = new Student()
            {
                FirstName = "Test student"
            };
            repository.entities.Add(studentToAdd);

            var controller = new StudentsController(repository);

            var studentsModels = controller.Get();
            Assert.IsTrue(studentsModels.Count() == 1);
            Assert.AreEqual(studentToAdd.FirstName, studentsModels.First().FirstName);
        }