コード例 #1
0
        public void TestCreateGetSevisBatchInfoDTOByBatchIdQuery()
        {
            var batch = new SevisBatchProcessing
            {
                BatchId = "batchId",
                DownloadDispositionCode = DispositionCode.BatchNeverSubmitted.Code,
                DownloadTries           = 1,
                Id = 2,
                LastDownloadTry        = DateTimeOffset.UtcNow.AddDays(1.0),
                LastUploadTry          = DateTimeOffset.UtcNow.AddDays(2.0),
                ProcessDispositionCode = DispositionCode.BatchNotYetProcessed.Code,
                RetrieveDate           = DateTimeOffset.UtcNow.AddDays(3.0),
                SendString             = "send string",
                SevisOrgId             = "sevis org Id",
                SevisUsername          = "******",
                SubmitDate             = DateTimeOffset.UtcNow.AddDays(4.0),
                TransactionLogString   = "transaction log",
                UploadDispositionCode  = DispositionCode.BusinessRuleViolations.Code,
                UploadTries            = 4
            };

            context.SevisBatchProcessings.Add(batch);
            var result = SevisBatchProcessingQueries.CreateGetSevisBatchInfoDTOByBatchIdQuery(context, batch.BatchId).ToList();

            Assert.AreEqual(1, result.Count);
        }
コード例 #2
0
        public void TestCreateGetSevisBatchInfoDTOByBatchIdQuery_BatchDoesNotExist()
        {
            var batch = new SevisBatchProcessing
            {
                BatchId = "batchId",
            };

            context.SevisBatchProcessings.Add(batch);
            var result = SevisBatchProcessingQueries.CreateGetSevisBatchInfoDTOByBatchIdQuery(context, "somebatchid").ToList();

            Assert.AreEqual(0, result.Count);
        }
コード例 #3
0
        /// <summary>
        /// Returns the batch info with the given batch id.
        /// </summary>
        /// <param name="batchId">The batch id.</param>
        /// /// <param name="userId">The id of the user requesting the batch status.</param>
        /// <param name="participantId">The participant to get the status for.</param>
        /// <param name="projectId">The project id of the participant.</param>
        /// <returns>The info dto or null of it does not exist.</returns>
        public async Task <SevisBatchInfoDTO> GetBatchInfoByBatchIdAsync(int userId, int projectId, int participantId, string batchId)
        {
            var participant = Context.Participants.Find(participantId);

            throwIfModelDoesNotExist(participantId, participant, typeof(Participant));
            throwSecurityViolationIfParticipantDoesNotBelongToProject(userId, projectId, participant);
            var commStatuses = await CreateGetParticipantPersonSevisCommStatusQuery(participantId, batchId).CountAsync();

            if (commStatuses == 0)
            {
                return(null);
            }
            else
            {
                return(await SevisBatchProcessingQueries.CreateGetSevisBatchInfoDTOByBatchIdQuery(this.Context, batchId).FirstOrDefaultAsync());
            }
        }