Ejemplo n.º 1
0
 public void TestDeserializeIssue4()
 {
     using (var fs = new FileStream(@"C:\temp\testFile.txt", FileMode.Open, FileAccess.Read))
     {
         PositivePayFile deserializeResults = FixedWidthSerializer.Deserialize <PositivePayFile>(fs);
     }
 }
Ejemplo n.º 2
0
        public void TestDeserializeWfFile()
        {
            var actualFile = FixedWidthSerializer.Deserialize <PositivePayFile>(Properties.Resources.pos_AP_20200207211501810);

            var expectedFile = new PositivePayFile
            {
                Header = new FileHeader
                {
                    AccountNumber = 5555333111,
                    BankID        = 164
                },
                CheckGroups = new[]
                {
                    new CheckGroup
                    {
                        Records = new []
                        {
                            new CheckRecord
                            {
                                CheckSerial   = 19983,
                                AccountNumber = 5555333111,
                                Amount        = 1050.00m,
                                IssueDate     = new DateTime(2020, 02, 03),
                                Payee         = "T & T TESTPAYEE, L.P"
                            }
                        },
                        Trailer = new CheckGroupTrailer
                        {
                            RecordCount = 1,
                            TotalAmount = 1050.00m
                        }
                    }
                }
            };

            //Assert.AreEqual(13, FixedWidthSerializer.CacheSize);
            Assert.IsTrue(expectedFile.ObjectEquals(actualFile));
        }
Ejemplo n.º 3
0
        public void TestSerialization()
        {
            var PositivePayFile = new PositivePayFile()
            {
                Header = new FileHeader()
                {
                    AccountNumber = 12345,
                    BankID        = 9999
                },
                CheckGroups = new[]
                {
                    new CheckGroup()
                    {
                        Records = new[]
                        {
                            new CheckRecord()
                            {
                                CheckSerial   = 5555555555,
                                IssueDate     = DateTime.Now,
                                AccountNumber = 77777777,
                                Amount        = 1.00M,
                                Payee         = "THIS IS A TEST"
                            }
                        },
                        Trailer = new CheckGroupTrailer()
                        {
                            RecordCount = 1,
                            TotalAmount = 1.00M
                        }
                    },
                    new CheckGroup()
                    {
                        Records = new[]
                        {
                            new CheckRecord()
                            {
                                CheckSerial   = 5555555555,
                                IssueDate     = DateTime.Now,
                                AccountNumber = 77777777,
                                Amount        = 1.00M,
                                Payee         = "THIS IS A TEST"
                            },
                            new CheckRecord()
                            {
                                CheckSerial   = 5555555555,
                                IssueDate     = DateTime.Now,
                                AccountNumber = 77777777,
                                Amount        = 1.00M,
                                Payee         = "THIS IS A TEST"
                            }
                        },
                        Trailer = new CheckGroupTrailer()
                        {
                            RecordCount = 2,
                            TotalAmount = 2.00M
                        }
                    }
                },
                Trailer = new FileTrailer()
                {
                    Start = "%00"
                }
            };

            File.WriteAllText(@"C:\temp\testFile.txt", FixedWidthSerializer.Serialize(PositivePayFile));
        }