public void Create_StudentWithData_NewStudent() { var newStudent = new DataPlus.Entities.Models.Student { Id = Guid.NewGuid(), DocumentNumber = "5555555", FirstName = "Jose", LastName = "Santos", Email = "*****@*****.**", Address = "Street 5", City = "City 2", DocumentType = EDocumentType.CC, PhoneNumber = "722222", Birth = new DateTime(1965, 5, 5) }; var repositoryWrapper = new Mock <IWrapperRepository>(); repositoryWrapper.Setup(x => x.Student.GetAll()).Returns(_studentList.AsQueryable); var studentService = new StudentService(repositoryWrapper.Object, _logger); var numberOfStudents = studentService.GetAll().Count; studentService.Create(newStudent); }
public void Create_EmptyStudent_Exception() { var newStudent = new DataPlus.Entities.Models.Student(); var repositoryWrapper = new Mock <IWrapperRepository>(); var studentService = new StudentService(repositoryWrapper.Object, _logger); Assert.Throws <NullReferenceException>(() => studentService.Create(newStudent)); }