예제 #1
0
파일: NachaFile.cs 프로젝트: evkap/DVS
		public NachaFile(NachaFileInfo info, List<NachaFileAppraiserEntry> listOfEntry)
			: this()
		{
			ValidateParams(info, listOfEntry);

			double totalAmount = 0;
			long entryHash = 0;
			_fileHeaderSection = new FileHeaderSection(info.CreationDate, info.CreationDate, info.FileIdModifier);
			_companyBatchHeaderSection = new CompanyBatchHeaderSection(info.CompanyDescriptiveDate, info.EffectiveEntryDate,
																																 info.BatchNumber);
			foreach (var entry in listOfEntry)
			{
				var parsedRoutingNumber = GetParsedRoutingNumber(entry.RoutingNumber);
				totalAmount += (double)entry.Amount;
				entryHash = (entryHash + parsedRoutingNumber.ReceivingDfiIdentification) % MaxEntryhashLength;
				int typeOfAccount = entry.TypeOfAccount == AccountType.Savings ? SavingTypeOfAccount : CheckingOrMoneymarketTypeOfAccount;
				_listOfEntryDetailSection.Add(new EntryDetailSection(typeOfAccount, parsedRoutingNumber.ReceivingDfiIdentification, parsedRoutingNumber.CheckDigit, entry.AccountNumber, (double)entry.Amount, entry.AppraiserOrCompanyId, entry.AppraiserOrCompanyName, entry.UniqueTraceNumber, entry.IsAppraiserWithCompany));
			}
			_companyBatchControlSection = new CompanyBatchControlSection(_listOfEntryDetailSection.Count, entryHash, totalAmount, info.BatchNumber);
			_fileTrailerSection = new FileTrailerSection(GetBlockCount(), _listOfEntryDetailSection.Count, entryHash, totalAmount);
		}
예제 #2
0
		public void FileHeaderSectionRender_should_return_correct_string()
		{
			//arrange
			var header = new FileHeaderSection(new DateTime(2012, 12, 12, 15, 52, 12), new DateTime(2012, 12, 12, 15, 52, 12), "A");
			//act
			var actual = header.RenderSection();
			//assert
			actual.Should().Be("101b121144557P4537372771212121552A094101SIERRA VISTA BANK      DIRECT VALUATION SOLUTI00000000");
		}
예제 #3
0
		public void SectionsRender_should_return_correct_string_length()
		{
			//arrange
			int size = 94;
			var header = new FileHeaderSection(DateTime.Now, DateTime.Now, "A");
			var companyBatchHeader = new CompanyBatchHeaderSection(DateTime.Now, DateTime.Now, 1234);
			var entryDetailSection = new EntryDetailSection(1, 5667, 1, "dfs23", 233456.45, "123454567", "First", 1, true);
			var companyBatchControlSection = new CompanyBatchControlSection(1, 1, 32154356.34, 1);
			var fileTrailerSection = new FileTrailerSection(1, 12, 1, 324543.44);
			//act
			var actual = header.RenderSection();
			var actual1 = companyBatchHeader.RenderSection();
			var actual2 = entryDetailSection.RenderSection();
			var actual3 = companyBatchControlSection.RenderSection();
			var actual4 = fileTrailerSection.RenderSection();

			//assert
			actual.Length.Should().Be(size);
			actual1.Length.Should().Be(size);
			actual2.Length.Should().Be(size);
			actual3.Length.Should().Be(size);
			actual4.Length.Should().Be(size);

		}