Esempio n. 1
0
        public void Test_CreateNewAccount_NewAccountAddedToTheRepository()
        {
            // Arrange
            var         unitOfWork            = new Mock <IUnitOfWork>();
            var         fakeAccountRepository = new Fakes.FakeAccountRepository();
            BankService bankService           = new BankService(unitOfWork.Object, fakeAccountRepository, new Fakes.GenerateIdEasy());

            // Act
            bankService.CreateNewAccount("Gold", "Daniil", "Boyko", 1000);

            // Asser
            Assert.That(fakeAccountRepository.GetById("1") != null);
        }
Esempio n. 2
0
        public void Test_WithdrawFromAccount_WithdrawMoneyFromAccount()
        {
            // Arrange
            var         unitOfWork            = new Mock <IUnitOfWork>();
            var         fakeAccountRepository = new Fakes.FakeAccountRepository();
            BankService bankService           = new BankService(unitOfWork.Object, fakeAccountRepository, new Fakes.GenerateIdEasy());

            bankService.CreateNewAccount("Gold", "Daniil", "Boyko", 1000);

            // Act
            bankService.WithdrawFromAccount(1000);

            // Asser
            Assert.That(fakeAccountRepository.GetById("1").Amount - 0 < double.Epsilon);
        }
Esempio n. 3
0
        public void Test_DeleteAccount_DeleteCurrentAccount()
        {
            // Arrange
            var         unitOfWork            = new Mock <IUnitOfWork>();
            var         fakeAccountRepository = new Fakes.FakeAccountRepository();
            BankService bankService           = new BankService(unitOfWork.Object, fakeAccountRepository, new Fakes.GenerateIdEasy());

            bankService.CreateNewAccount("Gold", "Daniil", "Boyko", 1000);
            bankService.CreateNewAccount("Base", "Piter", "Melow");

            // Act
            bankService.DeleteAccount();

            // Asser
            Assert.That(fakeAccountRepository.GetById("2") == null);
        }
Esempio n. 4
0
        public void Test_SelectAccount_SelectAccountForWorkWith()
        {
            // Arrange
            var         unitOfWork            = new Mock <IUnitOfWork>();
            var         fakeAccountRepository = new Fakes.FakeAccountRepository();
            BankService bankService           = new BankService(unitOfWork.Object, fakeAccountRepository, new Fakes.GenerateIdEasy());

            bankService.CreateNewAccount("Gold", "Daniil", "Boyko", 1000);
            bankService.CreateNewAccount("Base", "Piter", "Melow", 123);

            // Act
            bankService.SelectAccount("1");
            bankService.DepositToAccount(100);

            // Asser
            Assert.That(fakeAccountRepository.GetById("1").Amount - 1100 < double.Epsilon);
        }