public void BankAccountRepositoryGetMethodReturnNullWhenIdIsEmpty()
        {
            //Arrange
            var bankAccountRepository = new BankAccountRepository(fixture.unitOfWork, fixture.bankAccountLogger);

            //Act
            var bankAccount = bankAccountRepository.Get(Guid.Empty);

            //Assert
            Assert.Null(bankAccount);
        }
      public void BankAccountRepositoryGetMethodReturnNullWhenIdIsEmpty()
      {
         //Arrange
         var unitOfWork = new MainBcUnitOfWork();
         var bankAccountRepository = new BankAccountRepository(unitOfWork);

         //Act
         var bankAccount = bankAccountRepository.Get(Guid.Empty);

         //Assert
         Assert.IsNull(bankAccount);
      }
        public void BankAccountRepositoryGetMethodReturnNullWhenIdIsEmpty()
        {
            //Arrange
            var unitOfWork            = new MainBCUnitOfWork();
            var bankAccountRepository = new BankAccountRepository(unitOfWork);

            //Act
            var bankAccount = bankAccountRepository.Get(Guid.Empty);

            //Assert
            Assert.IsNull(bankAccount);
        }
        public void BankAccountRepositoryGetMethodReturnMaterializedEntityById()
        {
            //Arrange
            var bankAccountRepository = new BankAccountRepository(fixture.unitOfWork, fixture.bankAccountLogger);

            var selectedBankAccount = new Guid("0343C0B0-7C40-444A-B044-B463F36A1A1F");

            //Act
            var bankAccount = bankAccountRepository.Get(selectedBankAccount);

            //Assert
            Assert.NotNull(bankAccount);
            Assert.True(bankAccount.Id == selectedBankAccount);
        }
      public void BankAccountRepositoryGetMethodReturnMaterializedEntityById()
      {
         //Arrange
         var unitOfWork = new MainBcUnitOfWork();
         var bankAccountRepository = new BankAccountRepository(unitOfWork);

         var selectedBankAccount = new Guid("0343C0B0-7C40-444A-B044-B463F36A1A1F");

         //Act
         var bankAccount = bankAccountRepository.Get(selectedBankAccount);

         //Assert
         Assert.IsNotNull(bankAccount);
         Assert.IsTrue(bankAccount.Id == selectedBankAccount);
      }
        public void BankAccountRepositoryGetMethodReturnMaterializedEntityById()
        {
            //Arrange
            var unitOfWork            = new MainBCUnitOfWork();
            var bankAccountRepository = new BankAccountRepository(unitOfWork);

            var selectedBankAccount = new Guid("0343C0B0-7C40-444A-B044-B463F36A1A1F");

            //Act
            var bankAccount = bankAccountRepository.Get(selectedBankAccount);

            //Assert
            Assert.IsNotNull(bankAccount);
            Assert.IsTrue(bankAccount.Id == selectedBankAccount);
        }
Ejemplo n.º 7
0
        public void BankAccountRepositoryGetMethodReturnMaterializedEntityById()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            //DbContextManager.DbContextBuilder<TestDbContext> builder = new DbContextBuilder<TestDbContext>("Infrastructure.Data.Ef.Test.UnitOfWork.MainBCUnitOfWork", @"E:\MyCode\MyCommonLibrary\TestOutput\Infrastructure.Data.Ef.Test", "Infrastructure.Data.Ef.Test.UnitOfWork.Mapping");

            //var unitOfWork = builder.BuildDbContext();

            IBankAccountRepository bankAccountRepository = new BankAccountRepository(unitOfWork);

            Guid selectedBankAccount = new Guid("0343C0B0-7C40-444A-B044-B463F36A1A1F");

            //Act
            var bankAccount = bankAccountRepository.Get(selectedBankAccount);

            //Assert
            Assert.IsNotNull(bankAccount);
            Assert.IsTrue(bankAccount.Id == selectedBankAccount);
        }
        public void BankAccountRepositoryAddNewItemSaveItem()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            IBankAccountRepository bankAccountRepository = new BankAccountRepository(unitOfWork);

            Guid customerId = new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45");
            var bankAccountNumber = new BankAccountNumber("1111", "2222", "3333333333", "01");
            BankAccount newBankAccount = BankAccountFactory.CreateBankAccount(customerId,bankAccountNumber);
            newBankAccount.Id = IdentityGenerator.NewSequentialGuid();

            //Act

            bankAccountRepository.Add(newBankAccount);
            bankAccountRepository.UnitOfWork.Commit();

            //Assert

            var inserted = bankAccountRepository.Get(newBankAccount.Id);

            Assert.IsNotNull(inserted);
        }
        public void BankAccountRepositoryRemoveItemDeleteIt()
        {
            //Arrange
            var unitOfWork = new MainBCUnitOfWork();
            IBankAccountRepository bankAccountRepository = new BankAccountRepository(unitOfWork);

            Guid customerId = new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45");
            var bankAccountNumber = new BankAccountNumber("4444", "5555", "3333333333", "02");

            BankAccount newBankAccount = BankAccountFactory.CreateBankAccount(customerId, bankAccountNumber);
            newBankAccount.Id = IdentityGenerator.NewSequentialGuid();

            bankAccountRepository.Add(newBankAccount);
            bankAccountRepository.UnitOfWork.Commit();

            //Act

            bankAccountRepository.Remove(newBankAccount);
            bankAccountRepository.UnitOfWork.Commit();

            var result = bankAccountRepository.Get(newBankAccount.Id);

            //Assert
            Assert.IsNull(result);
        }