Skip to content

Commit

Permalink
#25 Infrastructure - BankAccountRepository - EF
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinajemuovic committed Jun 18, 2022
1 parent c754a8a commit fae0649
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Optivem.Kata.Banking.Infrastructure/BankAccountRepository.cs
Original file line number Diff line number Diff line change
@@ -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<BankAccount?> GetByAccountNumberAsync(AccountNumber accountNumber)
{
var bankAccount = (BankAccount?) null;
return Task.FromResult(bankAccount);
}

public void Update(BankAccount bankAccount)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit fae0649

Please sign in to comment.