mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-04 03:27:14 -05:00 
			
		
		
		
	Fix tests
This commit is contained in:
		
							parent
							
								
									05b8f5b400
								
							
						
					
					
						commit
						03af604e94
					
				@ -38,7 +38,7 @@ namespace Kyoo.Tests.Database
 | 
			
		||||
		{
 | 
			
		||||
			Context = new PostgresTestContext(postgres, output);
 | 
			
		||||
 | 
			
		||||
			Mock<ThumbnailsManager> thumbs = new();
 | 
			
		||||
			Mock<IThumbnailsManager> thumbs = new();
 | 
			
		||||
			CollectionRepository collection = new(_NewContext(), thumbs.Object);
 | 
			
		||||
			StudioRepository studio = new(_NewContext(), thumbs.Object);
 | 
			
		||||
			PeopleRepository people = new(_NewContext(),
 | 
			
		||||
 | 
			
		||||
@ -229,15 +229,21 @@ namespace Kyoo.Tests.Database
 | 
			
		||||
			{
 | 
			
		||||
				x.Show = null;
 | 
			
		||||
				x.People.Roles = null;
 | 
			
		||||
				x.People.Poster = null;
 | 
			
		||||
				x.People.Thumbnail = null;
 | 
			
		||||
				x.People.Logo = null;
 | 
			
		||||
			});
 | 
			
		||||
			retrieved.Studio!.Shows = null;
 | 
			
		||||
			expected.People.ForEach(x =>
 | 
			
		||||
			{
 | 
			
		||||
				x.Show = null;
 | 
			
		||||
				x.People.Roles = null;
 | 
			
		||||
				x.People.Poster = null;
 | 
			
		||||
				x.People.Thumbnail = null;
 | 
			
		||||
				x.People.Logo = null;
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			retrieved.Should().BeEquivalentTo(expected);
 | 
			
		||||
			KAssert.DeepEqual(retrieved, expected);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		[Fact]
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@
 | 
			
		||||
 | 
			
		||||
using FluentAssertions;
 | 
			
		||||
using JetBrains.Annotations;
 | 
			
		||||
using Kyoo.Abstractions.Models;
 | 
			
		||||
using Xunit.Sdk;
 | 
			
		||||
 | 
			
		||||
namespace Kyoo.Tests
 | 
			
		||||
@ -36,6 +37,22 @@ namespace Kyoo.Tests
 | 
			
		||||
		[AssertionMethod]
 | 
			
		||||
		public static void DeepEqual<T>(T expected, T value)
 | 
			
		||||
		{
 | 
			
		||||
			if (expected is IResource res && expected is IThumbnails thumbs) {
 | 
			
		||||
				if (thumbs.Poster != null)
 | 
			
		||||
					thumbs.Poster.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/poster";
 | 
			
		||||
				if (thumbs.Thumbnail != null)
 | 
			
		||||
					thumbs.Thumbnail.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/thumbnail";
 | 
			
		||||
				if (thumbs.Logo != null)
 | 
			
		||||
					thumbs.Logo.Path = $"/{expected.GetType().Name.ToLower()}/{res.Slug}/logo";
 | 
			
		||||
			}
 | 
			
		||||
			if (value is IResource resV && value is IThumbnails thumbsV) {
 | 
			
		||||
				if (thumbsV.Poster != null)
 | 
			
		||||
					thumbsV.Poster.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/poster";
 | 
			
		||||
				if (thumbsV.Thumbnail != null)
 | 
			
		||||
					thumbsV.Thumbnail.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/thumbnail";
 | 
			
		||||
				if (thumbsV.Logo != null)
 | 
			
		||||
					thumbsV.Logo.Path = $"/{value.GetType().Name.ToLower()}/{resV.Slug}/logo";
 | 
			
		||||
			}
 | 
			
		||||
			value.Should().BeEquivalentTo(expected);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user