Esempio n. 1
0
        private void VerifyFileImportLog(FIleProcessor.Models.FileImportLog source,
                                         DataTransferObjects.Responses.FileImportLog fileImportLog)
        {
            fileImportLog.ShouldNotBeNull();
            fileImportLog.Files.Count.ShouldBe(source.Files.Count);
            fileImportLog.ImportLogDateTime.ShouldBe(source.FileImportLogDateTime);

            foreach (ImportLogFile importLogFile in source.Files)
            {
                var foundFile = fileImportLog.Files.SingleOrDefault(f => f.FileId == importLogFile.FileId);
                foundFile.ShouldNotBeNull();
                foundFile.FileId.ShouldBe(importLogFile.FileId);
                foundFile.FileImportLogId.ShouldBe(fileImportLog.FileImportLogId);
                foundFile.MerchantId.ShouldBe(importLogFile.MerchantId);
                foundFile.OriginalFileName.ShouldBe(importLogFile.OriginalFileName);
                foundFile.FilePath.ShouldBe(importLogFile.FilePath);
                foundFile.FileProfileId.ShouldBe(importLogFile.FileProfileId);
                foundFile.FileUploadedDateTime.ShouldBe(importLogFile.UploadedDateTime);
                foundFile.UserId.ShouldBe(importLogFile.UserId);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Converts from.
        /// </summary>
        /// <param name="fileImportLog">The file import log.</param>
        /// <returns></returns>
        public FileImportLogResponse ConvertFrom(FileImportLog fileImportLog)
        {
            FileImportLogResponse fileImportLogResponse = new FileImportLogResponse
            {
                FileCount         = fileImportLog.Files.Count(),
                FileImportLogId   = fileImportLog.FileImportLogId,
                ImportLogDate     = fileImportLog.FileImportLogDateTime.Date,
                ImportLogDateTime = fileImportLog.FileImportLogDateTime,
                ImportLogTime     = fileImportLog.FileImportLogDateTime.TimeOfDay,
                Files             = new List <FileImportLogFile>()
            };

            foreach (ImportLogFile importLogFile in fileImportLog.Files)
            {
                FileImportLogFile fileImportLogFile = this.ConvertFrom(importLogFile);
                fileImportLogFile.FileImportLogId = fileImportLog.FileImportLogId;
                fileImportLogResponse.Files.Add(fileImportLogFile);
            }

            return(fileImportLogResponse);
        }