Adding slugs tests for seasons

This commit is contained in:
Zoe Roux 2021-06-13 19:13:05 +02:00
parent 3ad5a0d127
commit 1bb29be134

View File

@ -1,5 +1,7 @@
using System.Threading.Tasks;
using Kyoo.Controllers;
using Kyoo.Models;
using Xunit;
namespace Kyoo.Tests.SpecificTests
{
@ -11,5 +13,34 @@ namespace Kyoo.Tests.SpecificTests
{
_repository = Repositories.LibraryManager.SeasonRepository;
}
[Fact]
public async Task SlugEditTest()
{
Season season = await _repository.Get(1);
Assert.Equal("anohana-s1", season.Slug);
Show show = new()
{
ID = season.ShowID,
Slug = "new-slug"
};
await Repositories.LibraryManager.ShowRepository.Edit(show, false);
season = await _repository.Get(1);
Assert.Equal("new-slug-s1", season.Slug);
}
[Fact]
public async Task SeasonNumberEditTest()
{
Season season = await _repository.Get(1);
Assert.Equal("anohana-s1", season.Slug);
season = await _repository.Edit(new Season
{
ID = 1,
SeasonNumber = 2
}, false);
season = await _repository.Get(1);
Assert.Equal("anohana-s2", season.Slug);
}
}
}