public void FindBanksAccounts_Invoke_NullSpecThrowNewArgumentNullException_Test()
        {
            //Arrange
            IMainModuleUnitOfWork context      = this.GetUnitOfWork();
            ITraceManager         traceManager = this.GetTraceManager();
            BankAccountRepository repository   = new BankAccountRepository(context, traceManager);

            repository.GetBySpec(null);
        }
        public void FindBankAccount_Invoke_NullSpecThrowArgumentNullException_Test()
        {
            //Arrange
            IMainModuleUnitOfWork context      = this.GetUnitOfWork();
            ITraceManager         traceManager = this.GetTraceManager();
            BankAccountRepository repository   = new BankAccountRepository(context, traceManager);

            //Act
            BankAccount actual;

            actual = repository.GetBySpec(null)
                     .SingleOrDefault();
        }
        public void FindBanksAccounts_Invoke_AccountNumber_Test()
        {
            //Arrange
            IMainModuleUnitOfWork          context      = this.GetUnitOfWork();
            ITraceManager                  traceManager = this.GetTraceManager();
            BankAccountRepository          repository   = new BankAccountRepository(context, traceManager);
            BankAccountSearchSpecification spec         = new BankAccountSearchSpecification(bankAccountNumber, null);

            //Act
            IEnumerable <BankAccount> actual;

            actual = repository.GetBySpec(spec);

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count() == 1);
        }
        public void FindBanksAccounts_Invoke_CustomerName_Test()
        {
            //Arrange
            IMainModuleUnitOfWork context      = this.GetUnitOfWork();
            ITraceManager         traceManager = this.GetTraceManager();
            BankAccountRepository repository   = new BankAccountRepository(context, traceManager);

            string name = "Unai";
            BankAccountSearchSpecification spec = new BankAccountSearchSpecification(null, name);

            //Act
            IEnumerable <BankAccount> actual;

            actual = repository.GetBySpec(spec);

            //Assert
            Assert.IsNotNull(actual);
        }
        public void FindBankAccount_Invoke_InvalidCodeReturnNullObject_Test()
        {
            //Arrange
            IMainModuleUnitOfWork context      = this.GetUnitOfWork();
            ITraceManager         traceManager = this.GetTraceManager();
            BankAccountRepository repository   = new BankAccountRepository(context, traceManager);

            string invalidCode = "0200011111";
            BankAccountNumberSpecification spec = new BankAccountNumberSpecification(invalidCode);

            //Act
            BankAccount actual;

            actual = repository.GetBySpec(spec)
                     .SingleOrDefault();

            //Assert
            Assert.IsNull(actual);
        }
        public void FindBankAccount_Invoke_Test()
        {
            //Arrange
            IMainModuleUnitOfWork context      = this.GetUnitOfWork();
            ITraceManager         traceManager = this.GetTraceManager();
            BankAccountRepository repository   = new BankAccountRepository(context, traceManager);

            BankAccountNumberSpecification spec = new BankAccountNumberSpecification(bankAccountNumber);

            //Act
            BankAccount actual;

            actual = repository.GetBySpec(spec)
                     .SingleOrDefault();

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.BankAccountId == 1);
        }