-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
Huppy/Huppy.Tests/Huppy.IntegrationTests/Huppy.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="Xunit.DependencyInjection" Version="8.5.0" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.1.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Huppy.App\Huppy.App.csproj" /> | ||
<ProjectReference Include="..\..\Huppy.Core\Huppy.Core.csproj" /> | ||
<ProjectReference Include="..\..\Huppy.Infrastructure\Huppy.Infrastructure.csproj" /> | ||
<ProjectReference Include="..\..\Huppy.Kernel\Huppy.Kernel.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
23 changes: 23 additions & 0 deletions
23
Huppy/Huppy.Tests/Huppy.IntegrationTests/Services/UrbanServiceTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Huppy.Core.Interfaces.IServices; | ||
|
||
namespace Huppy.Tests.Services; | ||
|
||
public class UrbanServiceTests | ||
{ | ||
private readonly IUrbanService _urbanService; | ||
public UrbanServiceTests(IUrbanService urbanService) | ||
{ | ||
_urbanService = urbanService; | ||
} | ||
|
||
[Theory] | ||
[InlineData("Test")] | ||
[InlineData("Bonk")] | ||
public async Task GetDefinitionTests(string term) | ||
{ | ||
var result = (await _urbanService.GetDefinition(term)).List!.OrderByDescending(e => e.ThumbsUp - e.ThumbsDown).FirstOrDefault(); | ||
|
||
Assert.NotNull(result); | ||
Assert.False(string.IsNullOrEmpty(result?.Definition)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Huppy.App.Configuration; | ||
using Huppy.Core.Services.Huppy; | ||
using Huppy.Core.Utilities; | ||
using Huppy.Kernel; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.VisualStudio.TestPlatform.TestHost; | ||
using Serilog; | ||
|
||
namespace Huppy.Tests; | ||
|
||
public class Startup | ||
{ | ||
public void ConfigureHost(IHostBuilder hostBuilder) | ||
{ | ||
var appSettings = AppSettings.IsCreated | ||
? AppSettings.Load() | ||
: AppSettings.Create(); | ||
|
||
Log.Logger = SerilogConfigurator.ConfigureLogger(appSettings); | ||
|
||
hostBuilder.ConfigureHostConfiguration(host => | ||
{ | ||
host.AddUserSecrets<Program>(); | ||
}) | ||
.ConfigureServices(services => | ||
{ | ||
_ = new ModuleConfigurator(services) | ||
.AddAppSettings(appSettings) | ||
.AddLogger(Log.Logger) | ||
.AddDiscord() | ||
.AddServices() | ||
.AddDatabase() | ||
.AddHttpClients() | ||
.AddMiddlewares(); | ||
|
||
services.AddHostedService<HuppyHostedService>(); | ||
}) | ||
.ConfigureLogging(ctx => ctx.ClearProviders()) | ||
.UseSerilog(Log.Logger); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
global using Xunit; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters