public void GetOriginalReturnsEmptyStudentAssignmentWhenNoEntityExistsWithTheGivenAssignmenAndStudentId()
        {
            var assgnId   = "NoSuchAssgn";
            var studentId = "NoSuchStudent";

            var repository = new DbRepository <StudentAssignment>(this.dbFixture.dbContext);
            var service    = new StudentAssignmentService(repository);

            var assignment = service.GetOriginal(assgnId, studentId);

            Assert.Null(assignment);
        }
Esempio n. 2
0
 public StudentAssignmentsController(AppDbContext db, IMapper mapper, IUserService userService,
                                     AssignmentService assignmentService, AttachmentService attachmentService, GroupService groupService,
                                     StudentAssignmentService studentAssignmentService, ConversationService conversationService)
 {
     _db                       = db;
     _mapper                   = mapper;
     _userService              = userService;
     _assignmentService        = assignmentService;
     _attachmentService        = attachmentService;
     _groupService             = groupService;
     _studentAssignmentService = studentAssignmentService;
     _conversationService      = conversationService;
 }
        public void GetOriginalReturnsStudentAssignmentWithTheGivenAssignmenAndStudentId()
        {
            var assgnId   = "Assgn1";
            var studentId = "student2";

            var repository = new DbRepository <StudentAssignment>(this.dbFixture.dbContext);
            var service    = new StudentAssignmentService(repository);

            var assignment = service.GetOriginal(assgnId, studentId);

            Assert.Equal(assgnId, assignment.AssignmentId);
            Assert.Equal(studentId, assignment.StudentId);
        }
        public void GetStudentAssignmentsByStudentIdReturnsAllStudentAssignmentsWithTheGivenStudentId()
        {
            BaseServiceTests.Initialize();

            var studentId = "student2";

            var countAssgnWithId = this.dbFixture.dbContext.StudentAssignments
                                   .Where(sa => sa.StudentId == studentId)
                                   .Count();

            var repository = new DbRepository <StudentAssignment>(this.dbFixture.dbContext);
            var service    = new StudentAssignmentService(repository);

            Assert.Equal(countAssgnWithId, service.GetStudentAssignmentsByStudentId(studentId).Count());
        }
Esempio n. 5
0
 public ApplicationController(IHostEnvironment environment, StudentAssignmentService studentAssignmentService)
 {
     _environment = environment;
     _studentAssignmentService = studentAssignmentService;
 }