Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Tests #31

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ jobs:
env:
Serilog.WriteTo.2.Args.serverUrl: http://localhost:5341
Serilog.WriteTo.2.Args.apiKey: xxxxxx
RabbitMq.username: guest
RabbitMq.password: guest
RabbitMq.port: 5672
RabbitMq.hostUrl: amqp://localhost
RabbitMq.Username: guest
RabbitMq.Password: guest
RabbitMq.Port: 5672
RabbitMq.HostUrl: amqp://localhost
TibiaData.BaseAddress: http://localhost:5000
TibiaData.ApiVersion: v3/

- name: Restore NuGet Packages
run: dotnet restore

- name: Run Build
run: dotnet build --no-restore

# - name: Run Tests
# run: dotnet test --no-build
- name: Run Tests
run: dotnet test --no-build
6 changes: 1 addition & 5 deletions API/src/TibiaStalker.Api/TibiaStalker.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<ItemGroup>
<PackageReference Include="Asp.Versioning.Mvc" Version="7.1.0" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Dapper" Version="2.0.123">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="EFCore.NamingConventions" Version="7.0.2" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.2">
Expand All @@ -36,7 +32,7 @@
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.2.2" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
44 changes: 22 additions & 22 deletions API/src/TibiaStalker.Api/appsettings.Development-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{
"Name": "File",
"Args": {
"Path": "xxx",
"Path": "..\\..\\..\\Logs\\Logs-.txt",
"RollingInterval": "Day",
"Formatter": "Serilog.Formatting.Json.JsonFormatter, Serilog",
"restrictedToMinimumLevel": "Warning",
Expand All @@ -33,7 +33,7 @@
"PostgreSql": "Server=xxx;Port=xxx;Database=xxx;User Id=xxx;Password=xxx;"
},
"TibiaData": {
"BaseAddress": "{FullAddress}:{Port}",
"BaseAddress": "http://{FullAddress}:{Port}",
"ApiVersion": "{version}/",
"Timeout": "00:00:05"
},
Expand All @@ -58,28 +58,28 @@
}
},
"RabbitMq": {
"retries": 3,
"retryInterval": 2,
"username": "xxx",
"password": "xxx",
"virtualHost": "tibia-local",
"port": 5672,
"hostUrl": "amqp://localhost",
"exchange": {
"durable": true,
"autoDelete": false,
"name": "tibia-stalker"
"Retries": 3,
"RetryInterval": 2,
"Username": "guest",
"Password": "guest",
"VirtualHost": "tibia-stalker",
"Port": 5672,
"HostUrl": "amqp://localhost",
"Exchange": {
"Durable": true,
"AutoDelete": false,
"Name": "tibia-stalker"
},
"queue": {
"durable": true,
"exclusive": false,
"autoDelete": false
"Queue": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false
},
"deadLetter": {
"durable": true,
"exclusive": false,
"autoDelete": false,
"prefix": "dlx-"
"DeadLetter": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false,
"Prefix": "dlx-"
}
}
}
27 changes: 27 additions & 0 deletions API/src/TibiaStalker.Api/appsettings.Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"RabbitMq": {
"Retries": 3,
"RetryInterval": 2,
"Username": "guest",
"Password": "guest",
"VirtualHost": "tibia-stalker",
"Port": 5671,
"HostUrl": "amqp://localhost",
"Exchange": {
"Durable": true,
"AutoDelete": false,
"Name": "tibia-stalker"
},
"Queue": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false
},
"DeadLetter": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false,
"Prefix": "dlx-"
}
}
}
40 changes: 20 additions & 20 deletions API/src/TibiaStalker.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,28 @@
}
},
"RabbitMq": {
"retries": 3,
"retryInterval": 2,
"username": "${RABBITMQ_USER}",
"password": "${RABBITMQ_PASSWORD}",
"virtualHost": "tibia-local",
"port": "${RABBITMQ_PORT}",
"hostUrl": "${RABBITMQ_HOSTNAME}",
"exchange": {
"durable": true,
"autoDelete": false,
"name": "tibia-stalker"
"Retries": 3,
"RetryInterval": 2,
"Username": "${RABBITMQ_USER}",
"Password": "${RABBITMQ_PASSWORD}",
"VirtualHost": "tibia-stalker",
"Port": "${RABBITMQ_PORT}",
"HostUrl": "${RABBITMQ_HOSTNAME}",
"Exchange": {
"Durable": true,
"AutoDelete": false,
"Name": "tibia-stalker"
},
"queue": {
"durable": true,
"exclusive": false,
"autoDelete": false
"Queue": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false
},
"deadLetter": {
"durable": true,
"exclusive": false,
"autoDelete": false,
"prefix": "dlx-"
"DeadLetter": {
"Durable": true,
"Exclusive": false,
"AutoDelete": false,
"Prefix": "dlx-"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace TibiaStalker.Application.Interfaces;

public interface IDateTimeProvider
{
DateTime DateTimeUtcNow { get; }
DateOnly DateOnlyUtcNow { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public interface ISeederService
{
public Task Seed();
Task Seed();
}

public interface ISeeder<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace TibiaStalker.Application.Interfaces;

public interface ITibiaDataClient
{
public Task<IReadOnlyList<string>> FetchWorldsNames();
public Task<IReadOnlyList<string>> FetchCharactersOnline(string worldName);
Task<CharacterResult> FetchCharacter(string characterName, bool withRetryPolicy = true);
Task<IReadOnlyList<string>> FetchWorldsNames();
Task<IReadOnlyList<string>> FetchCharactersOnline(string worldName);
Task<CharacterResult> FetchCharacterWithRetry(string characterName);
Task<CharacterResult> FetchCharacterWithoutRetry(string characterName);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TibiaStalker.Application.Services;
namespace TibiaStalker.Application.Interfaces;

public interface ITrackCharacterService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task<CharacterWithCorrelationsResult> Handle(GetCharacterWithCorrel
_validator.ValidSearchTextLenght(request.Name);
_validator.ValidSearchTextCharacters(request.Name);

var character = await _tibiaDataClient.FetchCharacter(request.Name.Trim(), false);
var character = await _tibiaDataClient.FetchCharacterWithoutRetry(request.Name.Trim());
if (character is null)
{
throw new TibiaDataApiConnectionException();
Expand Down
12 changes: 6 additions & 6 deletions API/src/TibiaStalker.Domain/Entities/CharacterCorrelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
public class CharacterCorrelation : IEntity
{
/// <summary>
/// Id of specific correlation between two characters
/// ID of specific correlation between two characters
/// </summary>
public long CorrelationId { get; set; }

/// <summary>
/// Id of specific character that logout
/// ID of specific character that logout
/// </summary>
public int LogoutCharacterId { get; set; }

/// <summary>
/// Id of specific character that login
/// ID of specific character that login
/// </summary>
public int LoginCharacterId { get; set; }

/// <summary>
/// Quantity occurrence of combination
/// </summary>
public short NumberOfMatches { get; set; }
public int NumberOfMatches { get; set; }

/// <summary>
/// Date of first occurance
/// Date of first occurence
/// </summary>
public DateOnly CreateDate { get; set; }

/// <summary>
/// Date of last occurance
/// Date of last occurence
/// </summary>
public DateOnly LastMatchDate { get; set; }

Expand Down
Loading
Loading