public void DataOverflowInColumn_ThrowsExportException()
 {
     var definition = GetDefinition();
     var record = new ChequeRow()
         {
             AccountNo = 1234567890123 // Overflowed
         };
     var document = definition.Build();
     Assert.Throws<ExportException>(() => document.Export(new ChequeRow[] {record}));
 }
        public void DataOverflowInColumn_ThrowsExportException()
        {
            DocumentFormatDefinitionBuilder <ChequeRow> definition = GetDefinition();
            var record = new ChequeRow()
            {
                AccountNo = 1234567890123                  // Overflowed
            };
            IDocumentFormatDefinition <ChequeRow> document = definition.Build();

            Assert.Throws <ExportException>(() => document.Export(new ChequeRow[] { record }));
        }
        public void ValuesWithFullWidth_ExportedByFillingOutFullSpace()
        {
            var definition = GetDefinition();

            var record = new ChequeRow()
                {
                    AccountNo = 123456789012,
                    RecordType = ChequeRow.RecordTypeEnum.Outstanding,
                    AmountCents = 210987654321,
                    SerialNumber = 9876543210,
                    Date = new DateTime(2013, 12, 31)
                };
            var resultString = definition.Build().Export(new ChequeRow[] {record});
            Assert.That(resultString,
                        Is.EqualTo("123456789012O987654321021098765432120131231" +
                                   new string(' ', 1 + 50 + 16 + 256 + 16)));
        }
        public void RightJustifiedValues_AreFilledUpWithFillChar()
        {
            var definition = GetDefinition();

            var record = new ChequeRow()
                {
                    AccountNo = 123456789,
                    RecordType = ChequeRow.RecordTypeEnum.Outstanding,
                    AmountCents = 152,
                    SerialNumber = 123,
                    Date = new DateTime(2013, 12, 31)
                };
            var resultString = definition.Build().Export(new ChequeRow[] {record});
            Assert.That(resultString,
                        Is.EqualTo("000123456789O000000012300000000015220131231" +
                                   new string(' ', 1 + 50 + 16 + 256 + 16)));
        }
        public void ValuesWithFullWidth_ExportedByFillingOutFullSpace()
        {
            DocumentFormatDefinitionBuilder <ChequeRow> definition = GetDefinition();

            var record = new ChequeRow()
            {
                AccountNo    = 123456789012,
                RecordType   = ChequeRow.RecordTypeEnum.Outstanding,
                AmountCents  = 210987654321,
                SerialNumber = 9876543210,
                Date         = new DateTime(2013, 12, 31)
            };
            string resultString = definition.Build().Export(new ChequeRow[] { record });

            Assert.That(resultString,
                        Is.EqualTo("123456789012O987654321021098765432120131231" +
                                   new string(' ', 1 + 50 + 16 + 256 + 16)));
        }
        public void RightJustifiedValues_AreFilledUpWithFillChar()
        {
            DocumentFormatDefinitionBuilder <ChequeRow> definition = GetDefinition();

            var record = new ChequeRow()
            {
                AccountNo    = 123456789,
                RecordType   = ChequeRow.RecordTypeEnum.Outstanding,
                AmountCents  = 152,
                SerialNumber = 123,
                Date         = new DateTime(2013, 12, 31)
            };
            string resultString = definition.Build().Export(new ChequeRow[] { record });

            Assert.That(resultString,
                        Is.EqualTo("000123456789O000000012300000000015220131231" +
                                   new string(' ', 1 + 50 + 16 + 256 + 16)));
        }
 private string EnumConvertFunc(ChequeRow arg1, ChequeRow.RecordTypeEnum arg2)
 {
     return arg2 == ChequeRow.RecordTypeEnum.Outstanding ? "O" : "I";
 }
 private string EnumConvertFunc(ChequeRow arg1, ChequeRow.RecordTypeEnum arg2)
 {
     return(arg2 == ChequeRow.RecordTypeEnum.Outstanding ? "O" : "I");
 }