public AccountsReadService(AccountsRepository accountsRepository, ILogger <AccountsReadService> logger, Mapper mapper, TransactionsReadClient transactionsClient)
 {
     this.accountsRepository = accountsRepository;
     this.logger             = logger;
     this.mapper             = mapper;
     this.transactionsClient = transactionsClient;
 }
 public void AccountRepository_Where_Test()
 {
     ///integration test
     var repository = new AccountsRepository(new SDBOAppContext());
     var admin = repository.Where(a => a.Email.Contains("admisdfsdfn"));
     Assert.IsNotNull(admin);
 }
        public void SetProjectionListener(AccountsRepository repository, IServiceCollection services)
        {
            var config = new RabbitMqConfig();

            configuration.GetSection("RabbitMq").Bind(config);

            var logger   = services.BuildServiceProvider().GetService <ILogger <RabbitMqPublisher> >();
            var rabbitMq = new RabbitMqChannelFactory().CreateReadChannel <Models.Account, string>(config, "AccountsRead", logger);

            rabbitMq.Received += (sender, projection) =>
            {
                if (projection.Upsert != null && projection.Upsert.Length > 0)
                {
                    repository.Upsert(projection.Upsert);
                }
                if (projection.Upsert != null && projection.Upsert.Length == 0)
                {
                    repository.Clear();
                }
                if (projection.Remove != null)
                {
                    repository.Remove(projection.Remove);
                }
            };
        }
Beispiel #4
0
        public IHttpActionResult Get()
        {
            var repo        = new AccountsRepository();
            var accountList = repo.GetAccounts(_connectionString);

            return(Ok(accountList));
        }
Beispiel #5
0
        public IHttpActionResult GetById(Guid id)
        {
            var repo    = new AccountsRepository();
            var account = repo.GetAccount(_connectionString, id);

            return(Ok(account));
        }
        public void FindByPersonNameTest()
        {
            Person createdPerson = new Person();
            createdPerson.Name = "person name test";
            createdPerson.Document = "ZGMFX20A";
            createdPerson.Email = "*****@*****.**";

            PeopleRepository peopleRepository = new PeopleRepository();

            peopleRepository.Save(createdPerson);

            Account createdAccount = new Account();
            createdAccount.Agency = 435;
            createdAccount.Number = 123123123;
            createdAccount.OwnerId = createdPerson.Id;

            AccountsRepository repository = new AccountsRepository();

            repository.Save(createdAccount);

            Assert.AreNotEqual(0, createdAccount.Id);

            Account retrievedAccount = repository.FindSingle(a => a.PERSON.Name == createdPerson.Name);

            Assert.AreEqual(createdAccount, retrievedAccount);
        }
        public void TransactionRollbackTest()
        {
            PeopleRepository peopleRepository = new PeopleRepository();
            AccountsRepository accountsRepository = new AccountsRepository();
            BankDataContextFactory contextFactory = new BankDataContextFactory();

            Person createdPerson = new Person();
            createdPerson.Name = "transaction test";
            createdPerson.Document = "ZGMFX20A";
            createdPerson.Email = "*****@*****.**";

            Account createdAccount = new Account();
            createdAccount.Number = 2354235;
            createdAccount.Agency = 34;

            UnitOfWork unitOfWork = contextFactory.CreateUnitOfWork();

            peopleRepository.Save(createdPerson, unitOfWork);

            createdAccount.OwnerId = createdPerson.Id;

            accountsRepository.Save(createdAccount, unitOfWork);

            unitOfWork.Rollback();

            Assert.IsNull(peopleRepository.FindSingle(p => p.Name == createdPerson.Name));
            Assert.IsNull(accountsRepository.FindSingle(a => a.Number == createdAccount.Number));
        }
Beispiel #8
0
 public UnitOfWork(IDbContextFactory <APPDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)
 {
     _dbContext                        = dbContextFactory.GetContext();
     UserRepository                    = new UserRepository(_dbContext);
     AccountsRepository                = new AccountsRepository(_dbContext);
     Account_RolesRepository           = new Account_RolesRepository(_dbContext);
     RolesRepository                   = new RolesRepository(_dbContext);
     PermissionsRepository             = new PermissionsRepository(_dbContext);
     EmployeesRepository               = new EmployeesRepository(_dbContext);
     MenusRepository                   = new MenusRepository(_dbContext);
     JobPositionsRepository            = new JobPositionsRepository(_dbContext);
     MotorManufactureRepository        = new MotorManufactureRepository(_dbContext);
     MotorTypesRepository              = new MotorTypesRepository(_dbContext);
     ServicesRepository                = new ServicesRepository(_dbContext);
     MotorLiftsRepository              = new MotorLiftsRepository(_dbContext);
     SupplierRepository                = new SupplierRepository(_dbContext);
     CustomersRepository               = new CustomersRepository(_dbContext);
     AccessoriesRepository             = new AccessoriesRepository(_dbContext);
     TemporaryBill_ServiceRepository   = new TemporaryBill_ServiceRepository(_dbContext);
     TemporaryBillRepository           = new TemporaryBillRepository(_dbContext);
     TemporaryBill_AccesaryRepository  = new TemporaryBill_AccesaryRepository(_dbContext);
     ImportReceiptRepository           = new ImportReceiptRepository(_dbContext);
     ImportReceipt_AccessoryRepository = new ImportReceipt_AccessoryRepository(_dbContext);
     ServicePriceHistoryRepository     = new ServicePriceHistoryRepository(_dbContext);
     AccessoryPriceHistoryRepository   = new AccessoryPriceHistoryRepository(_dbContext);
 }
Beispiel #9
0
        public IHttpActionResult Login([FromBody] Models.User userData)
        {
            AccountsRepository accRepo = new AccountsRepository();
            bool isValid = accRepo.Login(userData.UserName, userData.Password.ToString());

            return(Ok(new { Status = "success" }));
        }
        public void CreateFindUpdateTest()
        {
            Person createdPerson = new Person();
            createdPerson.Name = "gandamu strike freedom";
            createdPerson.Document = "ZGMFX20A";
            createdPerson.Email = "*****@*****.**";

            PeopleRepository peopleRepository = new PeopleRepository();

            peopleRepository.Save(createdPerson);

            Account createdAccount = new Account();
            createdAccount.Agency = 435;
            createdAccount.Number = 123123123;
            createdAccount.OwnerId = createdPerson.Id;

            AccountsRepository repository = new AccountsRepository();

            repository.Save(createdAccount);

            Assert.AreNotEqual(0, createdAccount.Id);

            Account retrievedAccount = repository.FindSingle(a => a.Id == createdAccount.Id);

            Assert.AreEqual(createdAccount, retrievedAccount);

            retrievedAccount.Agency = 666;

            repository.Save(retrievedAccount);

            retrievedAccount = repository.FindSingle(a => a.Id == createdAccount.Id);

            Assert.AreEqual(666, retrievedAccount.Agency);
        }
Beispiel #11
0
 private void LoadBanks(IUnitOfWork uow)
 {
     allBanksList    = BankRepository.GetAllBanks(uow).ToList();
     activeBanksList = allBanksList.Where(x => !x.Deleted).ToList();
     accountsList    = AccountsRepository.GetAllAccounts(uow).ToList();
     regionsList     = BankRepository.GetAllBankRegions(uow).ToList();
 }
Beispiel #12
0
 public UnitOfWork(IDbContextFactory <APPDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)
 {
     _dbContext                     = dbContextFactory.GetContext();
     UserRepository                 = new UserRepository(_dbContext);
     MenuRepository                 = new MenuRepository(_dbContext);
     RolesRepository                = new RolesRepository(_dbContext);
     Role_PermissionsRepository     = new Role_PermissionsRepository(_dbContext);
     AccountsRepository             = new AccountsRepository(_dbContext);
     AccountRolesRepository         = new AccountRolesRepository(_dbContext);
     CategoryRepository             = new CategoryRepository(_dbContext);
     Content_CategoriesRepository   = new Content_CategoriesRepository(_dbContext);
     AuthorsRepository              = new AuthorsRepository(_dbContext);
     GroupsRepository               = new GroupsRepository(_dbContext);
     NewsSourcesRepository          = new NewsSourcesRepository(_dbContext);
     TypesRepository                = new TypesRepository(_dbContext);
     ContentTypesRepository         = new ContentTypesRepository(_dbContext);
     Content_GroupsRepository       = new Content_GroupsRepository(_dbContext);
     TitleImagesRepository          = new TitleImagesRepository(_dbContext);
     MediasRepository               = new MediasRepository(_dbContext);
     ContentsRepository             = new ContentsRepository(_dbContext);
     QuanLyDonGiaNhuanButRepository = new QuanLyDonGiaNhuanButRepository(_dbContext);
     TheLoai_HeSoRepository         = new TheLoai_HeSoRepository(_dbContext);
     NhuanButRepository             = new NhuanButRepository(_dbContext);
     ContactRepository              = new ContactRepository(_dbContext);
 }
Beispiel #13
0
        public void SelectCharacter(Client sender, params object[] args)
        {
            if (Guid.TryParse(args[0].ToString(), out Guid userGuid) &&
                int.TryParse(args[1].ToString(), out int accountId) &&
                int.TryParse(args[2].ToString(), out int characterIndex))
            {
                if (EntityHelper.GetAccounts().All(account => account.DbModel.Id != accountId))
                {
                    RoleplayContext ctx = Singletons.RoleplayContextFactory.Create();
                    using (AccountsRepository accountsRepository = new AccountsRepository(ctx))
                        using (CharactersRepository charactersRepository = new CharactersRepository(ctx))
                        {
                            AccountModel  accountModel  = accountsRepository.Get(accountId);
                            AccountEntity accountEntity = new AccountEntity(accountModel, sender);
                            accountEntity.Login(userGuid);

                            int characterId = accountEntity.DbModel.Characters.Where(character => character.IsAlive).ToList()[characterIndex].Id;

                            CharacterModel  characterModel  = charactersRepository.Get(characterId);
                            CharacterEntity characterEntity = new CharacterEntity(accountEntity, characterModel);
                            accountEntity.SelectCharacter(characterEntity);
                        }
                }
            }
            else
            {
                sender.Kick("Nie udało się zalogować. Skontaktuj się z administratorem.");
            }
        }
Beispiel #14
0
        public async Task <string> RegisterExternal(ExternalLoginBindingModel external)
        {
            AccountsRepository accountsRepository = new AccountsRepository();
            var result = await accountsRepository.RegisterExternal(external);

            return(result);
        }
Beispiel #15
0
 public AuthManager(
     UsersRepository usersRepository,
     AccountsRepository accountsRepository
     )
 {
     this.usersRepository    = usersRepository;
     this.accountsRepository = accountsRepository;
 }
Beispiel #16
0
        public UnitOfWork()
        {
            _appDbContext = new AppDbContext();

            Accounts = new AccountsRepository(_appDbContext);
            EmailVerificationTokens = new EmailVerificationTokenRepository(_appDbContext);
            AuthTokens = new AuthTokenRepository(_appDbContext);
        }
Beispiel #17
0
        public void AccountRepository_Where_Test()
        {
            ///integration test
            var repository = new AccountsRepository(new SDBOAppContext());
            var admin      = repository.Where(a => a.Email.Contains("admisdfsdfn"));

            Assert.IsNotNull(admin);
        }
 public override void Load()
 {
     //Todo: Need more work and test
     var db = new AccountDbContext();
     var ac = new AccountsRepository(db);
     //Todo: Bind your interfaces to their impelementors
     Bind<IAccountsRepository>().ToConstant<AccountsRepository>(ac).InSingletonScope();
 }
        public static bool IsAdmin(RegistrationDTO dto)
        {
            if (!AccountsRepository.Exists(dto))
            {
                return(false);
            }

            return(AccountsRepository.GetStatus(dto) == 1);
        }
Beispiel #20
0
 public virtual void SetUp()
 {
     _client  = new MusZil_APIClient(DEV_URL);
     _repo    = new AccountsRepository();
     _address = new Address("zil1fs6jhg4axvj9ekscq6v7ddwxxd9tthpxl7820q");
     _account = AccountFactory.New(_pk);
     _wallet  = new Wallet(_account);
     _zil     = new Zilliqa();
 }
Beispiel #21
0
        public async Task <string> RegisterExternal(ExternalLoginBindingModel external)
        {
            //var info = await AuthenticationManager.GetExternalLoginInfoAsync();

            AccountsRepository accountsRepository = new AccountsRepository();
            var result = await accountsRepository.RegisterExternal(external);

            return(result);
        }
        public MainViewModel()
        {
            // Initialize Data layer
            var fs                          = new MyAccounts.Business.IO.WindowsFileSystem();
            var workingCopy                 = new WorkingCopy(fs, Properties.Settings.Default.WorkingFolder);
            var accountsRepository          = new AccountsRepository(workingCopy);
            var accountCommandRepository    = new AccountCommandRepository(workingCopy);
            var placesRepository            = new PlacesRepository();
            var placeProvider               = PlaceProvider.Load(placesRepository);
            var placeInfoResolver           = new PlaceInfoResolver(placeProvider);
            var operationPatternTransformer = new UnifiedAccountOperationPatternTransformer(placeInfoResolver);
            var operationsRepository        = new OperationsRepository(workingCopy, new CsvAccountOperationManager(), operationPatternTransformer);

            // Initialize Managers
            var operationsManager = new OperationsManager(App.CacheManager, operationsRepository);
            var accountsManager   = new AccountsManager(App.CacheManager, accountsRepository);
            var importManager     = new ImportManager(App.CacheManager, accountCommandRepository, operationsManager);

            // Initialize View Models

            BusyIndicator = new BusyIndicatorViewModel();

            ImportsManagerViewModel = new ImportsManagerViewModel(BusyIndicator, fs, importManager);

            OperationsManagerViewModel = new OperationsManagerViewModel(BusyIndicator, operationsManager, importManager);
            AccountsManagerViewModel   = new AccountsManagerViewModel(BusyIndicator, accountsManager, operationsManager, importManager);
            DashboardViewModel         = new DashboardViewModel(BusyIndicator);
            GmcManager       = new GmcManager(BusyIndicator, App.CacheManager, operationsManager);
            _settingsManager = new SettingsManager(App.CacheManager);

            MessengerInstance.Register <Properties.Settings>(this, OnSettingsUpdated);
            _asyncMessageReceiver = new AsyncMessageReceiver(MessengerInstance);
            _asyncMessageReceiver.RegisterAsync <AccountDataInvalidated>(this, data => Refresh());

            if (!IsInDesignMode)
            {
                LoadCommand    = new AsyncCommand(Load);
                RefreshCommand = new AsyncCommand(Refresh);
            }
            else
            {
                AccountsManagerViewModel.Accounts.Add(
                    new AccountViewModel
                {
                    Name   = "Blaise CC",
                    Status =
                    {
                        Operations            =          7,
                        Balance               = 2541.7345M,
                        LastImportedOperation = "2012-0001"
                    }
                });

                AccountsManagerViewModel.CurrentAccount = AccountsManagerViewModel.Accounts.First();
            }
        }
Beispiel #23
0
        public ChatService(string databaseName)
        {
            var client = new MongoClient();

            mongoDB            = client.GetDatabase(databaseName);
            MessagesRepository = new MessagesRepository(mongoDB);
            AccountRepository  = new AccountsRepository(mongoDB);
            GroupsRepository   = new GroupsRepository(mongoDB);
            TasksRepository    = new ServerTasksRepository(mongoDB);
        }
Beispiel #24
0
        public async Task <ActionResult> SideNav()
        {
            var email = TempData["Email"].ToString();
            AccountsRepository accountsRepository = new AccountsRepository();
            ApplicationUser    data = await accountsRepository.GetInfoAsync(email);

            TempData["ImageUrl"] = data.Picture;
            TempData.Keep();
            return(View());
        }
Beispiel #25
0
        public AuthenticationViewModel(AccountsRepository repo)
        {
            _accountsRepo   = repo;
            _accountManager = new AccountManager();

            _accountManager.AccessSucceed       += resp => Authenticated?.Invoke(resp.User);
            _accountManager.AccessDenied        += resp => AuthenticationDenied?.Invoke();
            _accountManager.RegistrationDenied  += resp => RegistrationDenied?.Invoke();
            _accountManager.RegistrationSucceed += resp => Registrated?.Invoke(resp.User);
        }
Beispiel #26
0
        public async Task ThenNullIsReturnedIfCanNotFindByIndex(
            AccountsRepository sut,
            AccountEntity newEntity)
        {
            // Act
            var entity = await sut.Find(newEntity.Id);

            // Assert
            entity.Should().BeNull();
        }
Beispiel #27
0
        public void TestMethod1()
        {
            //Arrange
            AccountsRepository acc = new AccountsRepository();
            //Act
            var output = acc.Login("yatharth", "sharma");

            //Assert
            Assert.IsNotNull(output);
        }
Beispiel #28
0
        public IHttpActionResult Update(Guid id, ApiModels.Account account)
        {
            var repo = new AccountsRepository();

            if (repo.Update(_connectionString, account))
            {
                return(Ok());
            }

            return(BadRequest("Update Account Data Supplied is invalid."));
        }
Beispiel #29
0
        public StreamCreateDialogViewModel(IEventAggregator events, StreamsRepository streamsRepo, AccountsRepository acctsRepo, ConnectorBindings bindings)
        {
            DisplayName = "Create Stream";
            _events     = events;
            Bindings    = bindings;
            FilterTabs  = new BindableCollection <FilterTab>(Bindings.GetSelectionFilters().Select(f => new FilterTab(f)));
            _acctRepo   = acctsRepo;

            SelectionCount = Bindings.GetSelectedObjects().Count;
            _events.Subscribe(this);
        }
Beispiel #30
0
        public IHttpActionResult Delete(Guid id)
        {
            var repo = new AccountsRepository();

            if (repo.Delete(_connectionString, id))
            {
                return(Ok());
            }

            return(BadRequest("Delete Account Data Supplied is invalid."));
        }
Beispiel #31
0
 public DeleteAccount(AccountsRepository accountsRepository, string accountNumber) : base(accountsRepository)
 {
     _accountNumber = accountNumber;
     foreach (var acc in accountsRepository.Accounts)
     {
         if (acc.AccountNumber == accountNumber)
         {
             _backup = acc;
         }
     }
 }
Beispiel #32
0
 public AccountsWriteService(AccountsRepository accountsRepository,
                             ILogger <AccountsWriteService> logger,
                             Mapper mapper,
                             TransactionsWriteClient transactionsClient,
                             RabbitMqPublisher projectionChannel)
 {
     this.accountsRepository = accountsRepository;
     this.logger             = logger;
     this.mapper             = mapper;
     this.transactionsClient = transactionsClient;
     this.projectionChannel  = projectionChannel;
 }
Beispiel #33
0
        //[Authorize(Roles = "Admin")]
        public IHttpActionResult Signup([FromBody] Models.User userData)
        {
            AccountsRepository regObj  = new AccountsRepository();
            ApplicationUser    regData = new ApplicationUser();

            regData.EmailID    = userData.EmailID;
            regData.Password   = Encoding.UTF8.GetBytes(userData.Password.ToString());
            regData.UserName   = userData.UserName;
            regData.UserRoleId = userData.RoleId;

            return(Ok(regObj.Register(regData)));
        }
            public async void Should_AddAsync_Valid()
            {
                await using var context = new TestContext(ContextOptions);
                var repository = new AccountsRepository(
                    new Mock <ILogger <AbstractRepository <AccountsContext, AccountEntity> > >().Object,
                    context
                    );
                var newEntity = new AccountEntity();
                var result    = await repository.AddAsync(newEntity);

                Assert.NotNull(result);
            }
Beispiel #35
0
 public void Delete(Account acct)
 {
     try
     {
         IAccountRepository accountRepo = new AccountsRepository();
         accountRepo.DeleteAccount(acct);
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
Beispiel #36
0
 public bool Create(Account acct)
 {
     try
     {
         IAccountRepository accountRepo = new AccountsRepository();
         accountRepo.UpsertAccount(acct);
         return true;
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
Beispiel #37
0
 public bool CreateAccount(Account acct)
 {
     try
     {
         IAccountRepository accountRepo = new AccountsRepository();
         accountRepo.UpsertAccount(acct);
         return true;
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.NotFound);
     }
 }
        public async Task ThenAccountIsAddedIfNew(
            AccountsRepository sut,
            AccountEntity newEntity)
        {
            var expectedCountAfterAdd = (await sut.GetList()).Count + 1;

            // Act
            await sut.AddOrUpdate(newEntity);

            // Assert
            var actualCountAfterAdd = (await sut.GetList()).Count;

            actualCountAfterAdd.Should().Be(expectedCountAfterAdd);
        }
Beispiel #39
0
 public IEnumerable<Account> FindByEmailAddress(string emailAddress)
 {
     try
     {
         IAccountRepository accountRepo = new AccountsRepository();
         return accountRepo.Find(null, null, emailAddress);
     }
     catch (InvalidParamsException invPExp)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, invPExp.Message));
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
Beispiel #40
0
 public IEnumerable<Account> FindByName(string firstName, string lastName = "")
 {
     try
     {
         IAccountRepository accountRepo = new AccountsRepository();
         return accountRepo.Find(firstName, lastName, null);
     }
     catch (InvalidParamsException invPExp)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, invPExp.Message));
     }
     catch
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
 public SecuredDataService(AccountsRepository accountRepository,
     AccountUsersRepository accountUserRepository,
     AccountDestinationsRepository accountDestinationsRepository,
     AddressesRepository addressesRepository,
     ContactsRepository contactsRepository,
     ContactAddressesRepository contactAddressesRepository,
     MailingListsRepository mailingListsRepository,
     MailingListContactsRepository mailingListContactsRepository)
 {
     _accountRepository = accountRepository;
     _accountUserRepository = accountUserRepository;
     _accountDestinationsRepository = accountDestinationsRepository;
     _addressesRepository = addressesRepository;
     _contactsRepository = contactsRepository;
     _contactAddressesRepository = contactAddressesRepository;
     _mailingListsRepository = mailingListsRepository;
     _mailingListContactsRepository = mailingListContactsRepository;
 }
        public void RetrieveContactInformationIncludingContacsAddresses()
        {
            Account account = null;

            using (var repo = new AccountsRepository())
            {
                account = repo.GetSingle(a => a.Id == 1);
            }

            var contactsCount = account.Contacts.Count;
            var accountContactsAddresses = account.Contacts.First().ContactAddresses.Select(ca => ca.Address).Count();

            Assert.IsTrue(contactsCount == 1);
            Assert.IsTrue(accountContactsAddresses > 1);




        }
        protected AccountsRepository PopulateDummyAccounts()
        {
            AccountsRepository repo = new AccountsRepository();

            repo.DeleteAll();

            //arrange
            Account[] accounts = {
                               new Account {FirstName="jones", LastName="pavan", EmailAddress="*****@*****.**", Password="******", Status= Account.AccountStatus.Active},
                               new Account {FirstName="danielle", LastName="pavan", EmailAddress="*****@*****.**", Password="******", Status= Account.AccountStatus.Active},
                               new Account {FirstName="isabella", LastName="pavan", EmailAddress="*****@*****.**", Password="******", Status= Account.AccountStatus.Active},
                               new Account {FirstName="gabriel", LastName="pavan", EmailAddress="*****@*****.**", Password="******", Status= Account.AccountStatus.Active}
                           };

            foreach (Account a in accounts)
                repo.UpsertAccount(a);

            return repo;
        }
        public void SaveTest()
        {
            Account account = new Account();
            account.Number = 2345235;
            account.Agency = 166;

            Person owner = new Person();
            owner.Name = "Ryu Ken";
            owner.Document = "3451345";
            owner.Email = "*****@*****.**";

            account.Owner = owner;

            account.Save();

            AccountsRepository accountsRepository = new AccountsRepository();

            Assert.IsNotNull(accountsRepository.FindSingle(a => a.Id == account.Id));
            Assert.IsNotNull(accountsRepository.FindSingle(a => a.PERSON.Name == owner.Name));
            Assert.IsNotNull(accountsRepository.FindSingle(a => a.PERSON.Id == owner.Id));
        }
Beispiel #45
0
 public AccountViewModel()
 {
     repository = new AccountsRepository();
 }
        public void SaveTest()
        {
            var account1 = new Account();
            account1.Number = 2345235;
            account1.Agency = 166;

            var owner = new Person();
            owner.Name = "Ryu Ken";
            owner.Document = "3451345";
            owner.Email = "*****@*****.**";

            account1.Owner = owner;

            account1.Save();

            var account2 = new Account();
            account2.Number = 464567;
            account2.Agency = 345;

            owner.Accounts.Add(account2);

            owner.Save();

            var accountsRepository = new AccountsRepository();

            var accounts = accountsRepository.Find(a => a.PERSON.Id == owner.Id);

            Assert.IsNotNull(accounts);
            Assert.AreEqual(2, accounts.Count);
            Assert.IsTrue(accounts.Contains(account1));
            Assert.IsTrue(accounts.Contains(account2));
        }
 public Person()
 {
     AccountsRepository = new AccountsRepository();
     PeopleRepository = new PeopleRepository();
 }
Beispiel #48
0
 public IEnumerable<Account> GetAllAccounts()
 {
     IAccountRepository accountRepo = new AccountsRepository();
     return accountRepo.Accounts;
 }
 public Account()
 {
     AccountsRepository = new AccountsRepository();
     PeopleRepository = new PeopleRepository();
 }