예제 #1
0
            public void ShouldReturnValid()
            {
                var username  = "******";
                var password  = "";
                var rfcToFind = "CAC840428RH1";

                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);


                ISupplierService supplierService = new SupplierService(new ContpaqLegacySupplierProvider());
                SupplierManager  supplierManager = new SupplierManager(supplierService);

                var session = accountingManager.DoLogin(username, password);

                var companies = accountingManager.GetCompanies();

                Assert.NotEmpty(companies);

                accountingManager.OpenCompany(session, companies.FirstOrDefault().DBName);

                Assert.True(session.IsValid);

                var res = supplierManager.GetSupplierByRFC(session, rfcToFind);

                Assert.NotNull(res);
                Assert.Equal(rfcToFind, res.RFC);
            }
            public void ShouldNotBeEmpty()
            {
                var username = "******";
                var password = "";

                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);

                var session = accountingManager.DoLogin(username, password);

                Assert.True(session.IsValid);

                var companies = accountingManager.GetCompanies();

                Assert.NotEmpty(companies);

                accountingManager.OpenCompany(session, companies.FirstOrDefault().DBName);

                var journalEntryTypes = accountingManager.GetJournalEntryTypes(session);

                Assert.NotEmpty(journalEntryTypes);
            }
            public void ShouldReturnValues()
            {
                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);

                var companies = accountingManager.GetCompanies();

                Assert.NotEmpty(companies);
            }
            public void ShouldBeCorrect()
            {
                var username = "******";
                var password = "";

                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);

                var session = accountingManager.DoLogin(username, password);

                Assert.True(session.IsValid);
            }
            public void ShouldCreateNoMovements()
            {
                var username = "******";
                var password = "";

                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);

                var session = accountingManager.DoLogin(username, password);

                Assert.True(session.IsValid);

                var companies = accountingManager.GetCompanies();

                Assert.NotEmpty(companies);

                accountingManager.OpenCompany(session, companies.FirstOrDefault().DBName);

                List <JournalEntryMovement> journalEntryMovements = new List <JournalEntryMovement>();
                var journalEntry = new JournalEntry()
                {
                    Type         = "6",
                    Date         = DateTime.Now,
                    Adjust       = false,
                    Affect       = true,
                    Daily        = 0,
                    Guid         = Guid.NewGuid(),
                    Printed      = false,
                    SourceSystem = "11",
                    Concept      = Guid.NewGuid().ToString() + " desde UT",
                    //Number = 2,
                };

                journalEntry.JournalEntryMovement = journalEntryMovements;

                accountingManager.CreateJournalEntry(session, new List <JournalEntry>()
                {
                    journalEntry
                });
            }
            public void ShouldCreate()
            {
                var username = "******";
                var password = "";

                ILoginService            loginService            = new LoginService(new ContpaqLegacySessionProvider());
                ICompanyService          companyService          = new CompanyService(new ContpaqLegacyCompanyProvider());
                IJournalEntryTypeService journalEntryTypeService = new JournalEntryTypeService(new ContpaqLegacyJournalEntryTypeProvider());
                IJournalEntryService     journalEntryService     = new JournalEntryService(new ContpaqLegacyJournalEntryProvider());
                AccountingManager        accountingManager       = new AccountingManager(loginService, companyService,
                                                                                         journalEntryTypeService, journalEntryService);

                var session = accountingManager.DoLogin(username, password);

                Assert.True(session.IsValid);

                var companies = accountingManager.GetCompanies();

                Assert.NotEmpty(companies);

                accountingManager.OpenCompany(session, companies.FirstOrDefault().DBName);

                List <JournalEntryMovement> journalEntryMovements = new List <JournalEntryMovement>();

                var journalEntryMovement1 = new JournalEntryMovement()
                {
                    Account  = "20101000",
                    Amount   = 123,
                    AmountFC = 0,
                    Concept  = Guid.NewGuid().ToString() + "Concpept UT",
                    Guid     = Guid.NewGuid(),
                    JournalEntryMovementDaily = 0,
                    JournalEntryMovementType  = JournalEntryMovementType.DEBITS,
                    Number = 1,
                };

                var journalEntryMovement2 = new JournalEntryMovement()
                {
                    Account  = "10201000",
                    Amount   = 123,
                    AmountFC = 0,
                    Concept  = Guid.NewGuid().ToString() + "Concpept UT",
                    Guid     = Guid.NewGuid(),
                    JournalEntryMovementDaily = 0,
                    JournalEntryMovementType  = JournalEntryMovementType.CREDITS,
                    Number = 2,
                };

                journalEntryMovements.Add(journalEntryMovement1);
                journalEntryMovements.Add(journalEntryMovement2);

                var journalEntry = new JournalEntry()
                {
                    Type         = "6",
                    Date         = DateTime.Now,
                    Adjust       = false,
                    Affect       = true,
                    Daily        = 0,
                    Guid         = Guid.NewGuid(),
                    Printed      = false,
                    SourceSystem = "11",
                    Concept      = Guid.NewGuid().ToString() + " desde UT",
                    Number       = 2,
                };

                journalEntry.JournalEntryMovement = journalEntryMovements;


                List <JournalEntryMovement> journalEntryMovements2 = new List <JournalEntryMovement>();

                var journalEntryMovement12 = new JournalEntryMovement()
                {
                    Account  = "20101000",
                    Amount   = 123,
                    AmountFC = 0,
                    Concept  = Guid.NewGuid().ToString() + "Concpept UT 2 ",
                    Guid     = Guid.NewGuid(),
                    JournalEntryMovementDaily = 0,
                    JournalEntryMovementType  = JournalEntryMovementType.DEBITS,
                    Number = 1,
                };

                var journalEntryMovement22 = new JournalEntryMovement()
                {
                    Account  = "10201000",
                    Amount   = 123,
                    AmountFC = 0,
                    Concept  = Guid.NewGuid().ToString() + "Concpept UT 2 ",
                    Guid     = Guid.NewGuid(),
                    JournalEntryMovementDaily = 0,
                    JournalEntryMovementType  = JournalEntryMovementType.CREDITS,
                    Number = 2,
                };

                journalEntryMovements2.Add(journalEntryMovement12);
                journalEntryMovements2.Add(journalEntryMovement22);

                var journalEntry2 = new JournalEntry()
                {
                    Type         = "6",
                    Date         = DateTime.Now,
                    Adjust       = false,
                    Affect       = true,
                    Daily        = 0,
                    Guid         = Guid.NewGuid(),
                    Printed      = false,
                    SourceSystem = "11",
                    Concept      = Guid.NewGuid().ToString() + " desde UT",
                    Number       = 2,
                };

                journalEntry2.JournalEntryMovement = journalEntryMovements2;



                accountingManager.CreateJournalEntry(session, new List <JournalEntry>()
                {
                    journalEntry, journalEntry2
                });
            }