示例#1
0
        public void CreateAccountTypes_saves_AccountTypes_via_context()
        {
            var options = new DbContextOptionsBuilder <IpsDBContext>()
                          .UseInMemoryDatabase(databaseName: "Add_writes_to_database")
                          .Options;

            // Run the test against one instance of the context
            using (var context = new IpsDBContext(options))
            {
                var service = new AccountTypeService(context);

                AccountType accountType1 = new AccountType();
                accountType1.AccountTypeName = "Personal";
                AccountType accountType2 = new AccountType();
                accountType2.AccountTypeName = "Corporate";
                service.AddAccountType(accountType1);
                service.AddAccountType(accountType2);

                context.SaveChanges();
            }

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new IpsDBContext(options))
            {
                Assert.Equal(2, context.AccountType.Count());
            }
        }
 public async Task <ActionResult <LmailitmsRequest> > GetMailItem(string declarationno)
 // public ActionResult<LMailitms> GetMailItem(string mailItem)
 {
     using (IpsDBContext ipsDBContext = new IpsDBContext())
     {
         var mailitems = ipsDBContext.lmailitmsRequest.FirstOrDefault(x => x.MailitmFid == declarationno);
         return(mailitems);
     }
 }
示例#3
0
        public void CreatePersonalAccount_saves_a_PersonalAccount_via_context()
        {
            var options = new DbContextOptionsBuilder <IpsDBContext>()
                          .UseInMemoryDatabase(databaseName: "Add_writes_to_database")
                          .Options;

            // Run the test against one instance of the context
            using (var context = new IpsDBContext(options))
            {
                var service = new PersonalAccountService(context);
                List <AssociatedIndividual> associatedIndividuals = new List <AssociatedIndividual>()
                {
                    new AssociatedIndividual
                    {
                        AccountTypeId = 1,
                        DateofBirth   = new DateTime(2011, 10, 1),
                        FirstName     = "Rahul",
                        LastName      = "Mahajan",
                        Title         = "Mr"
                    },
                    new AssociatedIndividual
                    {
                        AccountTypeId = 1,
                        DateofBirth   = new DateTime(2011, 10, 1),
                        FirstName     = "Vishal",
                        LastName      = "Mahajan",
                        Title         = "Mr"
                    }
                };

                PersonalAccount personalAccount = new PersonalAccount
                {
                    AccountName = "My Accounts 1",
                    AccountNo   = "123456",
                    BSB         = "123",
                    FirstName   = "Karim",
                    LastName    = "Meghani",
                    TFN         = "XYZ1234",
                    AssociatedIndividualPersonal = associatedIndividuals
                };
                service.AddPersonalAccount(personalAccount);

                context.SaveChanges();
            }

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new IpsDBContext(options))
            {
                Assert.Equal(1, context.PersonalAccount.Count());
            }
        }
示例#4
0
 public PersonalAccountService(IpsDBContext context)
 {
     _context = context;
 }
示例#5
0
 public AccountTypeService(IpsDBContext context)
 {
     _context = context;
 }
示例#6
0
 public CorporateAccountService(IpsDBContext context) : base(context)
 {
     _context = context;
 }
示例#7
0
        public void CreateCorporateAccount_saves_a_CorporateAccount_via_context()
        {
            var options = new DbContextOptionsBuilder <IpsDBContext>()
                          .UseInMemoryDatabase(databaseName: "Add_writes_to_database")
                          .Options;

            // Run the test against one instance of the context
            using (var context = new IpsDBContext(options))
            {
                var service = new CorporateAccountService(context);
                List <AssociatedIndividual> associatedIndividuals = new List <AssociatedIndividual>()
                {
                    new AssociatedIndividual
                    {
                        AccountTypeId = 2,
                        DateofBirth   = new DateTime(2011, 10, 1),
                        FirstName     = "Rahul",
                        LastName      = "Mahajan",
                        Title         = "Mr"
                    },
                    new AssociatedIndividual
                    {
                        AccountTypeId = 2,
                        DateofBirth   = new DateTime(2011, 10, 1),
                        FirstName     = "Vishal",
                        LastName      = "Mahajan",
                        Title         = "Mr"
                    }
                };
                List <CompanyOfficer> companyOfficers = new List <CompanyOfficer>()
                {
                    new CompanyOfficer
                    {
                        FirstName = "Vishwas",
                        LastName  = "Mahajan",
                        Title     = "Mr"
                    },
                    new CompanyOfficer
                    {
                        FirstName = "Bakul",
                        LastName  = "Mahajan",
                        Title     = "Mr"
                    }
                };

                CorporateAccount corporateAccount = new CorporateAccount
                {
                    AccountName = "My Corporate Account 1",
                    AccountNo   = "123456",
                    BSB         = "123",
                    ABN         = "abc123",
                    CompanyName = "My New Company",
                    AssociatedIndividualCorporate = associatedIndividuals,
                    CompanyOfficers = companyOfficers
                };
                service.AddCorporateAccount(corporateAccount);

                context.SaveChanges();
            }

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new IpsDBContext(options))
            {
                Assert.Equal(1, context.CorporateAccount.Count());
            }
        }