From fae064986390755dd946fe6e6182209584c8d1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentina=20Cupa=C4=87?= Date: Sat, 18 Jun 2022 16:17:55 +0200 Subject: [PATCH] #25 Infrastructure - BankAccountRepository - EF --- .../BankAccountRepository.cs | 28 +++++++++++++++ .../BankAccountRepositoryTest.cs | 34 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 src/Optivem.Kata.Banking.Infrastructure/BankAccountRepository.cs create mode 100644 test/Optivem.Kata.Banking.Test/Infrastructure/BankAccountRepositoryTest.cs diff --git a/src/Optivem.Kata.Banking.Infrastructure/BankAccountRepository.cs b/src/Optivem.Kata.Banking.Infrastructure/BankAccountRepository.cs new file mode 100644 index 0000000..1f669cd --- /dev/null +++ b/src/Optivem.Kata.Banking.Infrastructure/BankAccountRepository.cs @@ -0,0 +1,28 @@ +using Optivem.Kata.Banking.Core.Domain.BankAccounts; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Optivem.Kata.Banking.Infrastructure +{ + public class BankAccountRepository : IBankAccountRepository + { + public void Add(BankAccount bankAccount) + { + throw new NotImplementedException(); + } + + public Task GetByAccountNumberAsync(AccountNumber accountNumber) + { + var bankAccount = (BankAccount?) null; + return Task.FromResult(bankAccount); + } + + public void Update(BankAccount bankAccount) + { + throw new NotImplementedException(); + } + } +} diff --git a/test/Optivem.Kata.Banking.Test/Infrastructure/BankAccountRepositoryTest.cs b/test/Optivem.Kata.Banking.Test/Infrastructure/BankAccountRepositoryTest.cs new file mode 100644 index 0000000..697325f --- /dev/null +++ b/test/Optivem.Kata.Banking.Test/Infrastructure/BankAccountRepositoryTest.cs @@ -0,0 +1,34 @@ +using FluentAssertions; +using Optivem.Kata.Banking.Core.Domain.BankAccounts; +using Optivem.Kata.Banking.Infrastructure; +using Optivem.Kata.Banking.Test.Common.Builders.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Optivem.Kata.Banking.Test.Infrastructure +{ + public class BankAccountRepositoryTest + { + private readonly BankAccountRepository _repository; + + public BankAccountRepositoryTest() + { + _repository = new BankAccountRepository(); + } + + [Fact] + public async Task Should_return_null_given_non_existent_account_number() + { + var accountNumber = AccountNumber.From(BankAccountDefaults.DefaultAccountNumber); + + // TODO: VC: Refactor name + var bankAccount = await _repository.GetByAccountNumberAsync(accountNumber); + + bankAccount.Should().BeNull(); + } + } +}