示例#1
0
        public async Task GetPeriodDropdownListAsync_ImportToUnKnownAccount()
        {
            // Arrange
            _mockConfiguration.Setup(c => c.GetValue(It.IsAny <string>())).Returns("balancefileupload-test-01");
            _fileAccessor.Setup(c => c.ReadFileAsync(It.IsAny <FileUploadModel>())).Returns(Task.FromResult(new string[] {
                "AccountName 01 \t 45.56",
                "AccountName 02 \t 55.56",
                "AccountName 03 \t 11.56",
                "AccountName 04 \t 36.56",
                "AccountName 05 \t 99",
            }));

            using (var uow = _applicationDbFactory.BeginUnitOfWorkAsync().Result)
            {
                var recordCountBeforeImport = uow.AccountPeriodBalances.GetAll().Count();

                // Act
                var msg = new FileUploadModel
                {
                    Extension = "txt",
                    FileName  = "testFile",
                    FileType  = Shared.Enum.FileType.UploadDocument,
                    PeriodId  = 1
                };
                await _balanceFileImportProcess.ProcessAsync(msg);

                // Assert
                var recordCountAfteImport = uow.AccountPeriodBalances.GetAll().Count();
                Assert.IsTrue(recordCountBeforeImport == 0, "Record count before import should be zero");
                Assert.IsTrue(recordCountAfteImport == 0, "Record count after import should be zero");
            }
        }
示例#2
0
 public Task RunAsync()
 {
     return(_queueAccessor.Receive(async balanceFileImportInfo =>
     {
         await _balanceFileImportProcess.ProcessAsync(balanceFileImportInfo);
     }));
 }
 public async Task ProcessFileAsync(FileUploadModel message)
 {
     await _balanceFileImportProcess.ProcessAsync(message);
 }