Skip to content

Commit

Permalink
Rename Person model to Sender (#88)
Browse files Browse the repository at this point in the history
* Rename Person model to Sender

* Update Hackney.Shared.HousingSearch package version
  • Loading branch information
AnnaGolosova authored Nov 30, 2021
1 parent 545dbdd commit 418c0d0
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion HousingSearchApi.Tests/HousingSearchApi.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<PackageReference Include="Docker.DotNet" Version="3.125.4" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Hackney.Core.ElasticSearch" Version="1.45.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.14.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.17.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ namespace HousingSearchApi.Tests.V1.E2ETests.Fixtures
public class TransactionsFixture : BaseFixture
{
private const string IndexName = "transactions";
private const int PersonsCount = 5;
private const int SendersCount = 5;

private static readonly Fixture _fixture = new Fixture();

public static List<QueryablePerson> Persons { get; } = CreatePersonsData(PersonsCount);
public static List<QueryableSender> Senders { get; } = CreateSendersData(SendersCount);

public TransactionsFixture(IElasticClient elasticClient, HttpClient httpHttpClient) : base(elasticClient, httpHttpClient)
{
WaitForESInstance();
}

private static List<QueryablePerson> CreatePersonsData(int personsCount)
private static List<QueryableSender> CreateSendersData(int personsCount)
{
return _fixture.CreateMany<QueryablePerson>(personsCount).ToList();
return _fixture.CreateMany<QueryableSender>(personsCount).ToList();
}

public void GivenAnAssetIndexExists()
Expand Down Expand Up @@ -59,10 +59,10 @@ private List<QueryableTransaction> CreateTransactionsData(int transactionsCount)

for (var i = 0; i < transactionsCount; i++)
{
var personIndex = random.Next(PersonsCount);
var personIndex = random.Next(SendersCount);

var transaction = _fixture.Create<QueryableTransaction>();
transaction.Sender = Persons[personIndex];
transaction.Sender = Senders[personIndex];

listOfTransactions.Add(transaction);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task WhenRequestContainsSearchText(string searchText = null)

public async Task WhenAPageSizeIsProvided(int pageSize)
{
var route = new Uri($"{BaseTransactionsRoute}?searchText={TransactionsFixture.Persons.First().FullName}&pageSize={pageSize}",
var route = new Uri($"{BaseTransactionsRoute}?searchText={TransactionsFixture.Senders.First().FullName}&pageSize={pageSize}",
UriKind.Relative);

_lastResponse = await _httpClient.GetAsync(route).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void ServiceReturnsOkWithExactPageSize()
public void ServiceReturnsOkWithMatchesByFullName()
{
this.Given(_ => _transactionsFixture.GivenAnAssetIndexExists())
.When(_ => _transactionsSteps.WhenRequestContainsSearchText(TransactionsFixture.Persons.First().FullName))
.Then(_ => _transactionsSteps.ThenThatTextShouldBeInTheResult(TransactionsFixture.Persons.First().FullName))
.When(_ => _transactionsSteps.WhenRequestContainsSearchText(TransactionsFixture.Senders.First().FullName))
.Then(_ => _transactionsSteps.ThenThatTextShouldBeInTheResult(TransactionsFixture.Senders.First().FullName))
.BDDfy();
}
}
Expand Down
2 changes: 1 addition & 1 deletion HousingSearchApi.Tests/V1/Factories/DomainFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void CanMapASharedDomainSuspenseResolutionInfoObjectToADomainObject()
[Fact]
public void CanMapASharedDomainPersonTypeObjectToADomainObject()
{
var sharedDomain = _fixture.Create<Person>();
var sharedDomain = _fixture.Create<Sender>();
var domain = sharedDomain.ToDomain();
sharedDomain.Should().BeEquivalentTo(domain);
}
Expand Down
2 changes: 1 addition & 1 deletion HousingSearchApi/HousingSearchApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<PackageReference Include="Hackney.Core.Logging" Version="1.30.0" />
<PackageReference Include="Hackney.Core.Middleware" Version="1.30.0" />
<PackageReference Include="Hackney.Core.Validation" Version="1.30.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.14.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.17.0" />
<PackageReference Include="Microsoft.AspNetCore.HealthChecks" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace HousingSearchApi.V1.Boundary.Responses.Transactions
{
public class Person
public class Sender
{
public Guid Id { get; }

public string FullName { get; }

private Person(Guid id, string fullName)
private Sender(Guid id, string fullName)
{
Id = id;
FullName = fullName;
}

public static Person Create(Guid id, string fullName)
public static Sender Create(Guid id, string fullName)
{
return new Person(id, fullName);
return new Sender(id, fullName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public class TransactionResponse
/// "FullName": "Kian Hayward"
/// }
/// </example>
public Person Sender { get; }
public Sender Sender { get; }

/// <summary>
/// ToDO: No information about this field
Expand All @@ -181,7 +181,7 @@ public class TransactionResponse

private TransactionResponse(Guid id, Guid targetId, TargetType targetType, short periodNo, short financialYear, short financialMonth, string transactionSource, TransactionType transactionType,
DateTime transactionDate, decimal transactionAmount, string paymentReference, string bankAccountNumber, bool isSuspense, SuspenseResolutionInfo suspenseResolutionInfo,
decimal paidAmount, decimal chargedAmount, decimal balanceAmount, decimal housingBenefitAmount, string address, Person sender, string fund)
decimal paidAmount, decimal chargedAmount, decimal balanceAmount, decimal housingBenefitAmount, string address, Sender sender, string fund)
{
Id = id;
TargetId = targetId;
Expand All @@ -208,7 +208,7 @@ private TransactionResponse(Guid id, Guid targetId, TargetType targetType, short

public static TransactionResponse Create(Guid id, Guid targetId, TargetType targetType, short periodNo, short financialYear, short financialMonth, string transactionSource, TransactionType transactionType,
DateTime transactionDate, decimal transactionAmount, string paymentReference, string bankAccountNumber, bool isSuspense, SuspenseResolutionInfo suspenseResolutionInfo,
decimal paidAmount, decimal chargedAmount, decimal balanceAmount, decimal housingBenefitAmount, string address, Person person, string fund)
decimal paidAmount, decimal chargedAmount, decimal balanceAmount, decimal housingBenefitAmount, string address, Sender person, string fund)
{
return new TransactionResponse(id, targetId, targetType, periodNo, financialYear, financialMonth, transactionSource, transactionType, transactionDate, transactionAmount,
paymentReference, bankAccountNumber, isSuspense, suspenseResolutionInfo, paidAmount, chargedAmount, balanceAmount,
Expand Down
8 changes: 4 additions & 4 deletions HousingSearchApi/V1/Factories/DomainFactory.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using SuspenseResolutionInfoResponse = HousingSearchApi.V1.Boundary.Responses.Transactions.SuspenseResolutionInfo;
using SuspenseResolutionInfoDomain = Hackney.Shared.HousingSearch.Domain.Transactions.SuspenseResolutionInfo;

using PersonResponse = HousingSearchApi.V1.Boundary.Responses.Transactions.Person;
using PersonDomain = Hackney.Shared.HousingSearch.Domain.Transactions.Person;
using SenderResponse = HousingSearchApi.V1.Boundary.Responses.Transactions.Sender;
using SenderDomain = Hackney.Shared.HousingSearch.Domain.Transactions.Sender;

namespace HousingSearchApi.V1.Factories
{
Expand All @@ -13,9 +13,9 @@ public static SuspenseResolutionInfoResponse ToDomain(this SuspenseResolutionInf
return SuspenseResolutionInfoResponse.Create(sharedDomain.ResolutionDate, sharedDomain.IsConfirmed, sharedDomain.IsApproved, sharedDomain.Note);
}

public static PersonResponse ToDomain(this PersonDomain sharedDomain)
public static SenderResponse ToDomain(this SenderDomain sharedDomain)
{
return PersonResponse.Create(sharedDomain.Id, sharedDomain.FullName);
return SenderResponse.Create(sharedDomain.Id, sharedDomain.FullName);
}
}
}

0 comments on commit 418c0d0

Please sign in to comment.