mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-01 04:34:50 -04:00
Fix back tests
This commit is contained in:
parent
4217d471c4
commit
7ad1383acb
@ -16,6 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -284,6 +285,8 @@ namespace Kyoo.Tests.Database
|
|||||||
await _repository.Create(value);
|
await _repository.Create(value);
|
||||||
ICollection<Episode> ret = await _repository.Search(query);
|
ICollection<Episode> ret = await _repository.Search(query);
|
||||||
value.Show = TestSample.Get<Show>();
|
value.Show = TestSample.Get<Show>();
|
||||||
|
value.Show.AddedDate = DateTime.UnixEpoch;
|
||||||
|
ret.First().Show.AddedDate = DateTime.UnixEpoch;
|
||||||
KAssert.DeepEqual(value, ret.First());
|
KAssert.DeepEqual(value, ret.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
// along with Kyoo. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Kyoo.Abstractions.Models;
|
using Kyoo.Abstractions.Models;
|
||||||
@ -37,7 +38,8 @@ namespace Kyoo.Tests
|
|||||||
[AssertionMethod]
|
[AssertionMethod]
|
||||||
public static void DeepEqual<T>(T expected, T value)
|
public static void DeepEqual<T>(T expected, T value)
|
||||||
{
|
{
|
||||||
if (expected is IResource res && expected is IThumbnails thumbs) {
|
if (expected is IResource res and IThumbnails thumbs)
|
||||||
|
{
|
||||||
if (thumbs.Poster != null)
|
if (thumbs.Poster != null)
|
||||||
thumbs.Poster.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/poster";
|
thumbs.Poster.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/poster";
|
||||||
if (thumbs.Thumbnail != null)
|
if (thumbs.Thumbnail != null)
|
||||||
@ -45,7 +47,8 @@ namespace Kyoo.Tests
|
|||||||
if (thumbs.Logo != null)
|
if (thumbs.Logo != null)
|
||||||
thumbs.Logo.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/logo";
|
thumbs.Logo.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/logo";
|
||||||
}
|
}
|
||||||
if (value is IResource resV && value is IThumbnails thumbsV) {
|
if (value is IResource resV and IThumbnails thumbsV)
|
||||||
|
{
|
||||||
if (thumbsV.Poster != null)
|
if (thumbsV.Poster != null)
|
||||||
thumbsV.Poster.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/poster";
|
thumbsV.Poster.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/poster";
|
||||||
if (thumbsV.Thumbnail != null)
|
if (thumbsV.Thumbnail != null)
|
||||||
@ -53,6 +56,11 @@ namespace Kyoo.Tests
|
|||||||
if (thumbsV.Logo != null)
|
if (thumbsV.Logo != null)
|
||||||
thumbsV.Logo.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/logo";
|
thumbsV.Logo.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/logo";
|
||||||
}
|
}
|
||||||
|
if (expected is IAddedDate ea && value is IAddedDate va)
|
||||||
|
{
|
||||||
|
ea.AddedDate = DateTime.UnixEpoch;
|
||||||
|
va.AddedDate = DateTime.UnixEpoch;
|
||||||
|
}
|
||||||
value.Should().BeEquivalentTo(expected);
|
value.Should().BeEquivalentTo(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user