-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into feature/autositemap
- Loading branch information
Showing
7 changed files
with
136 additions
and
6 deletions.
There are no files selected for viewing
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
2 changes: 2 additions & 0 deletions
2
src/Sidio.Sitemap.AspNetCore.Examples.MvcWebApplication.Tests/GlobalUsings.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,2 @@ | ||
global using Xunit; | ||
global using FluentAssertions; |
88 changes: 88 additions & 0 deletions
88
....Examples.MvcWebApplication.Tests/MvcWebApplication/Controllers/SitemapControllerTests.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,88 @@ | ||
using Microsoft.AspNetCore.Mvc.Testing; | ||
|
||
namespace Sidio.Sitemap.AspNetCore.Examples.MvcWebApplication.Tests.MvcWebApplication.Controllers; | ||
|
||
public sealed class SitemapControllerTests : IClassFixture<WebApplicationFactory<Program>> | ||
{ | ||
private readonly WebApplicationFactory<Program> _factory; | ||
|
||
public SitemapControllerTests(WebApplicationFactory<Program> factory) | ||
{ | ||
_factory = factory; | ||
} | ||
|
||
[Fact] | ||
public async Task SitemapIndex_ReturnsSitemapIndex() | ||
{ | ||
// arrange | ||
var client = _factory.CreateClient(); | ||
|
||
// act | ||
var response = await client.GetAsync("/sitemap.xml"); | ||
|
||
// assert | ||
response.IsSuccessStatusCode.Should().BeTrue(); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
content.Should().Contain("sitemapindex"); | ||
} | ||
|
||
[Fact] | ||
public async Task SitemapHome_ReturnsSitemap() | ||
{ | ||
// arrange | ||
var client = _factory.CreateClient(); | ||
|
||
// act | ||
var response = await client.GetAsync("/sitemap-home.xml"); | ||
|
||
// assert | ||
response.IsSuccessStatusCode.Should().BeTrue(); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
content.Should().Contain("sitemap"); | ||
} | ||
|
||
[Fact] | ||
public async Task SitemapNews_ReturnsSitemap() | ||
{ | ||
// arrange | ||
var client = _factory.CreateClient(); | ||
|
||
// act | ||
var response = await client.GetAsync("/sitemap-news.xml"); | ||
|
||
// assert | ||
response.IsSuccessStatusCode.Should().BeTrue(); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
content.Should().Contain("news:news"); | ||
} | ||
|
||
[Fact] | ||
public async Task SitemapImages_ReturnsSitemap() | ||
{ | ||
// arrange | ||
var client = _factory.CreateClient(); | ||
|
||
// act | ||
var response = await client.GetAsync("/sitemap-images.xml"); | ||
|
||
// assert | ||
response.IsSuccessStatusCode.Should().BeTrue(); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
content.Should().Contain("image:image"); | ||
} | ||
|
||
[Fact] | ||
public async Task SitemapVideos_ReturnsSitemap() | ||
{ | ||
// arrange | ||
var client = _factory.CreateClient(); | ||
|
||
// act | ||
var response = await client.GetAsync("/sitemap-videos.xml"); | ||
|
||
// assert | ||
response.IsSuccessStatusCode.Should().BeTrue(); | ||
var content = await response.Content.ReadAsStringAsync(); | ||
content.Should().Contain("video:video"); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
....MvcWebApplication.Tests/Sidio.Sitemap.AspNetCore.Examples.MvcWebApplication.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,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="6.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="xunit" Version="2.8.1" /> | ||
<PackageReference Include="xunit.analyzers" Version="1.14.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.6" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="6.0.2"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Sidio.Sitemap.AspNetCore.Examples.MvcWebApplication\Sidio.Sitemap.AspNetCore.Examples.MvcWebApplication.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
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
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