Пример #1
0
        public void Initialize()
        {
            var context = new DbContext();

            var accountAssetRepository  = new MockAccountAssetRepository(context);
            var assetHolderRepository   = new MockAssetHolderRepository(context);
            var clientAccountRepository = new MockClientAccountRepository(context);
            var clientRepository        = new MockClientRepository(context);

            _accountAssetService  = new AccountAssetService(accountAssetRepository);
            _assetHolderService   = new AssetHolderService(assetHolderRepository);
            _clientAccountService = new ClientAccountService(clientAccountRepository);
            _clientService        = new ClientService(clientRepository);
        }
        public override void RegisterServices(ContainerBuilder builder)
        {
            var context = new DbContext();

            var accountAssetRepository  = new MockAccountAssetRepository(context);
            var assetHolderRepository   = new MockAssetHolderRepository(context);
            var clientAccountRepository = new MockClientAccountRepository(context);
            var clientRepository        = new MockClientRepository(context);

            var accountAssetService  = new AccountAssetService(accountAssetRepository);
            var assetHolderService   = new AssetHolderService(assetHolderRepository);
            var clientAccountService = new ClientAccountService(clientAccountRepository);
            var clientService        = new ClientService(clientRepository);

            builder.RegisterInstance(accountAssetService).As <IAccountAssetService>().InstancePerDependency();
            builder.RegisterInstance(assetHolderService).As <IAssetHolderService>().InstancePerDependency();
            builder.RegisterInstance(clientAccountService).As <IClientAccountService>().InstancePerDependency();
            builder.RegisterInstance(clientService).As <IClientService>().InstancePerDependency();
        }