public void LockBankAccountReturnFalseIfIdentifierIsEmpty()
      {
         //Arrange
         var bankAccountRepository = new StubIBankAccountRepository();
         bankAccountRepository.GetGuid = guid =>
         {
            if (guid == Guid.Empty) {
               return null;
            }
            else
            {
               return new BankAccount
               {
               };
            }
         };
         var customerRepository = new StubICustomerRepository();
         IBankTransferService transferService = new BankTransferService();

         IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService);

         //Act
         var result = bankingService.LockBankAccount(Guid.Empty);

         //Assert
         Assert.IsFalse(result);
      }
        public void LockBankAccountReturnFalseIfBankAccountNotExist()
        {
            //Arrange
            SICustomerRepository customerRepository = new SICustomerRepository();
            IBankTransferService transferService = new BankTransferService();
            SIBankAccountRepository bankAccountRepository = new SIBankAccountRepository();
            bankAccountRepository.UnitOfWorkGet = () =>
            {
                var uow = new SIUnitOfWork();
                uow.Commit = () => { };

                return uow;
            };
            bankAccountRepository.GetGuid = (guid) =>
            {
                return null;
            };

            IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService);

            //Act
            var result = bankingService.LockBankAccount(Guid.NewGuid());

            //Assert
            Assert.IsFalse(result);
        }
      public void LockBankAccountReturnTrueIfBankAccountIsLocked()
      {
         //Arrange
         var customerRepository = new StubICustomerRepository();
         IBankTransferService transferService = new BankTransferService();

         var bankAccountRepository = new StubIBankAccountRepository();
         bankAccountRepository.UnitOfWorkGet = () =>
         {
            var uow = new StubIUnitOfWork();
            uow.Commit = () => { };

            return uow;
         };

         bankAccountRepository.GetGuid = (guid) =>
         {
            var customer = new Customer();
            customer.GenerateNewIdentity();

            var bankAccount = new BankAccount();
            bankAccount.GenerateNewIdentity();

            bankAccount.SetCustomerOwnerOfThisBankAccount(customer);

            return bankAccount;
         };

         IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService);

         //Act
         var result = bankingService.LockBankAccount(Guid.NewGuid());

         //Assert
         Assert.IsTrue(result);
      }
        public void LockBankAccountReturnTrueIfBankAccountIsLocked()
        {
            //Arrange
            SICustomerRepository customerRepository = new SICustomerRepository();
            IBankTransferService transferService = new BankTransferService();
            ITypeAdapter adapter = PrepareTypeAdapter();
            SIBankAccountRepository bankAccountRepository = new SIBankAccountRepository();
            bankAccountRepository.UnitOfWorkGet = () =>
            {
                var uow = new SIUnitOfWork();
                uow.Commit = () => { };

                return uow;
            };

            bankAccountRepository.GetGuid = (guid) =>
            {
                return new BankAccount() { Id = Guid.NewGuid(), CustomerId = Guid.NewGuid() };
            };

            IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService, adapter);

            //Act
            var result = bankingService.LockBankAccount(Guid.NewGuid());

            //Assert
            Assert.IsTrue(result);
        }
        public void LockBankAccountReturnFalseIfIdentifierIsEmpty()
        {
            //Arrange
            SIBankAccountRepository bankAccountRepository = new SIBankAccountRepository();
            SICustomerRepository customerRepository = new SICustomerRepository();
            IBankTransferService transferService = new BankTransferService();
            ITypeAdapter adapter = PrepareTypeAdapter();

            IBankAppService bankingService = new BankAppService(bankAccountRepository, customerRepository, transferService, adapter);

            //Act
            var result = bankingService.LockBankAccount(Guid.Empty);

            //Assert
            Assert.IsFalse(result);
        }