Beispiel #1
0
        public async Task CanCreateSignatures()
        {
            var assignmentId = 1;
            var planId       = 1;


            _assignmentRepositoryMock.Setup(x => x.GetSignaturesForAssignment(assignmentId))
            .Returns(Task.FromResult((new List <Signature>()).AsEnumerable()))
            .Verifiable();

            _assignmentRepositoryMock.Setup(x => x.GetAssignment(assignmentId))
            .Returns(Task.FromResult(new Assignment()
            {
                Id          = assignmentId,
                PlanId      = planId,
                CompletedAt = DateTime.UtcNow
            })).Verifiable();

            int sectionSkillId = 5;
            int sectionLevelId = 6;

            _assignmentRepositoryMock.Setup(x => x.InsertSignature(It.Is <Signature>(y => y.SectionSkillId == sectionSkillId && y.SectionLevelId == sectionLevelId)))
            .Returns(Task.CompletedTask)
            .Verifiable();

            await _assignmentService.CreateSignatures(assignmentId, 1, new List <NewSignatureDto>() { new NewSignatureDto()
                                                                                                      {
                                                                                                          SectionLevelId = sectionLevelId, SectionSkillId = sectionSkillId
                                                                                                      } });

            _assignmentRepositoryMock.Verify();
        }