示例#1
0
 public SubsidiaryAccount BuildAccount(SubsidiaryFund fund, ILookup <AccountType> lookup)
 {
     return(new SubsidiaryAccount
     {
         Name = this.Name,
         BankNumber = this.BankNumber,
         Comments = this.Comments,
         AccountType = lookup.All.FirstOrDefault(t => t.Name.Equals(AccountType.Checking)),
         Fund = fund
     });
 }
        public void Init()
        {
            context      = TestDbContextFactory.Build();
            organization = context.Organizations.First();
            expenseType  = context.TransactionSubTypes.OfType <ExpenseType>().First();

            var accountType = context.AccountTypes.First();
            var fundType    = context.FundTypes.First();

            account = new SubsidiaryAccount
            {
                Id           = -1,
                Name         = "Test Account",
                UpdatedBy    = "Foo",
                CreatedBy    = "Foo",
                AccountType  = accountType,
                Organization = organization
            };

            fund = new SubsidiaryFund
            {
                Id           = -1,
                Name         = fundType.Name,
                BankNumber   = "42",
                Code         = "123",
                CreatedBy    = "Foo",
                UpdatedBy    = "Foo",
                FundType     = fundType,
                Organization = organization
            };

            fund.Subsidiaries.Add(account);
            account.Fund = fund;


            context.Funds.Add(fund);

            payee = new Payee
            {
                Name         = "Test",
                AddressLine1 = "123 Street",
                City         = "Foo",
                State        = "FO",
                PostalCode   = "98503",
                Organization = organization,
                UpdatedBy    = "Foo",
                CreatedBy    = "Foo"
            };

            context.Payees.Add(payee);

            context.SaveChanges();
        }
示例#3
0
        public void Can_persist_SubsidiaryFund()
        {
            var fundType = context.FundTypes.First();
            var fund     = new SubsidiaryFund
            {
                Id           = -1,
                Name         = fundType.Name,
                BankNumber   = "42",
                Code         = "123",
                CreatedBy    = "Foo",
                UpdatedBy    = "Foo",
                FundType     = fundType,
                Organization = organization
            };


            context.Funds.Add(fund);
            context.SaveChanges();

            Assert.AreNotEqual(-1, fund.Id);
        }
示例#4
0
        public void Init()
        {
            context      = TestDbContextFactory.Build();
            organization = context.Organizations.First();
            receiptType  = context.TransactionSubTypes.OfType <ReceiptType>().First();

            var accountType = context.AccountTypes.First();
            var fundType    = context.FundTypes.First();

            account = new SubsidiaryAccount
            {
                Id           = -1,
                Name         = "Test Account",
                UpdatedBy    = "Foo",
                CreatedBy    = "Foo",
                AccountType  = accountType,
                Organization = organization
            };

            fund = new SubsidiaryFund
            {
                Id           = -1,
                Name         = fundType.Name,
                BankNumber   = "42",
                Code         = "123",
                CreatedBy    = "Foo",
                UpdatedBy    = "Foo",
                FundType     = fundType,
                Organization = organization
            };

            fund.Subsidiaries.Add(account);
            account.Fund = fund;


            context.Funds.Add(fund);

            context.SaveChanges();
        }
示例#5
0
        public void Can_persist_SubsidiaryFund_with_a_SubsidiaryAccount()
        {
            var fundType = context.FundTypes.First();
            var fund     = new SubsidiaryFund
            {
                Id           = -1,
                Name         = fundType.Name,
                BankNumber   = "42",
                Code         = "123",
                CreatedBy    = "Foo",
                UpdatedBy    = "Foo",
                FundType     = fundType,
                Organization = organization
            };

            var accountType       = context.AccountTypes.First();
            var subsidiaryAccount = new SubsidiaryAccount
            {
                Id           = -1,
                Name         = "SubsidiaryFund",
                BankNumber   = "42",
                CreatedBy    = "Foo",
                UpdatedBy    = "Foo",
                AccountType  = accountType,
                Organization = organization
            };


            fund.Subsidiaries.Add(subsidiaryAccount);
            subsidiaryAccount.Fund = fund;

            context.Funds.Add(fund);
            context.SaveChanges();

            Assert.AreNotEqual(-1, fund.Id);
            Assert.AreNotEqual(-1, subsidiaryAccount.Id);
        }