public void Validate_entities_account_bad_info_failed() { IMigrationSet set = new MigrationSet() { Info = new MigrationInfo() { Year = 0, Origin = MigrationOrigin.A3ASESORnom, Type = MigrationType.ChartOfAccount, VatNumber = "vatNumber", Version = "1.0" }, }; Account account1 = new Account() { Code = "4301", Description = "desc", Id = Guid.NewGuid(), Line = 1, Source = "scr" }; Account account2 = new Account() { Code = "4300", Description = "desc", Id = Guid.NewGuid(), Line = 2, Source = "scr" }; set.Entities = new IMigrationEntity[2] { account1, account2 }; var result = set.IsValid(); result.errors.Any().Should().BeFalse(); result.isValid.Should().BeFalse(); }
public void Validate_entities_outputInvoice_failed() { IMigrationSet set = new MigrationSet() { Info = new MigrationInfo() { Year = 2010, Origin = MigrationOrigin.A3ASESORnom, Type = MigrationType.OutputInvoice, VatNumber = "vatNumber", Version = "2.0" }, }; IOutputInvoice entity1 = new OutputInvoice() { Id = Guid.NewGuid(), Line = 1, InvoiceDate = DateTime.Now, JournalDate = DateTime.Now, InvoiceNumber = "number", PartnerAccount = "43000001", PartnerName = "name", VatNumber = "53336699A", Lines = new List <IOutputInvoiceLine>() { new OutputInvoiceLine() { Id = Guid.NewGuid(), Line = 1, BaseAmount = 1210, TaxAmount = 210, Transaction = "OP_INT", } }.ToArray(), Source = "source" }; IOutputInvoice entity2 = new OutputInvoice() { Id = Guid.NewGuid(), Line = 1, InvoiceDate = DateTime.Now, JournalDate = DateTime.Now, InvoiceNumber = "number", PartnerAccount = "43000001", PartnerName = "name", VatNumber = "53336699A", Lines = new List <IOutputInvoiceLine>() { new OutputInvoiceLine() { Id = Guid.NewGuid(), Line = 1, BaseAmount = 1210, TaxAmount = 210, Transaction = "OP_INT", } }.ToArray(), //Source = "source" }; set.Entities = new IMigrationEntity[2] { entity1, entity2 }; var result = set.IsValid(); result.errors.Any().Should().BeTrue(); result.isValid.Should().BeFalse(); }
public void Validate_entities_journal_failed() { IMigrationSet set = new MigrationSet() { Info = new MigrationInfo() { Year = 2010, Origin = MigrationOrigin.A3ASESORnom, Type = MigrationType.Journal, VatNumber = "vatNumber", Version = "2.0" }, }; IJournal entity1 = new Journal() { Date = DateTime.Now, Type = JournalTypes.Regular, Id = Guid.NewGuid(), Line = 1, Source = "scr", Number = "1", Lines = new IJournalLine[] { new JournalLine() { Account = "430", AccountDescription = "desc", Concept = "concept", Credit = 1.0M, Id = Guid.NewGuid(), Line = 1, Number = "1" }, new JournalLine() { Account = "430", AccountDescription = "desc", Concept = "concept", Credit = 1.0M, Id = Guid.NewGuid(), Line = 2, Number = "2" }, } }; IJournal entity2 = new Journal() { Date = DateTime.Now, Type = JournalTypes.Regular, Id = Guid.NewGuid(), Line = 3, Source = "scr", //Number = "3", Lines = new IJournalLine[] { new JournalLine() { Account = "430", AccountDescription = "desc", Concept = "concept", Credit = 1.0M, Id = Guid.NewGuid(), Line = 3, Number = "3" }, new JournalLine() { Account = "430", AccountDescription = "desc", Concept = "concept", Credit = 1.0M, Id = Guid.NewGuid(), Line = 4, Number = "2" }, } }; set.Entities = new IMigrationEntity[2] { entity1, entity2 }; var result = set.IsValid(); result.errors.Any().Should().BeTrue(); result.isValid.Should().BeFalse(); }