replace moq with nsubstitute (#1365)
This commit is contained in:
@@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.FFmpeg.Runtime;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Emby;
|
||||
@@ -27,16 +27,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -59,16 +59,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -82,15 +82,15 @@ public class EmbyPathReplacementServiceTests
|
||||
{
|
||||
var mediaSource = new EmbyMediaSource { OperatingSystem = "Windows" };
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = service.ReplaceNetworkPath(
|
||||
mediaSource,
|
||||
@@ -115,16 +115,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -147,16 +147,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -179,16 +179,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -211,16 +211,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -243,16 +243,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
@@ -275,16 +275,16 @@ public class EmbyPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetEmbyPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetEmbyPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new EmbyPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<EmbyPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<EmbyPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementEmbyPath(
|
||||
0,
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
<PackageReference Include="NSubstitute" Version="5.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="Serilog" Version="3.0.1" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using ErsatzTV.Core.Interfaces.FFmpeg;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.FFmpeg;
|
||||
@@ -13,8 +13,8 @@ public class HlsPlaylistFilterTests
|
||||
[SetUp]
|
||||
public void SetUp() =>
|
||||
_hlsPlaylistFilter = new HlsPlaylistFilter(
|
||||
new Mock<ITempFilePool>().Object,
|
||||
new Mock<ILogger<HlsPlaylistFilter>>().Object
|
||||
Substitute.For<ITempFilePool>(),
|
||||
Substitute.For<ILogger<HlsPlaylistFilter>>()
|
||||
);
|
||||
|
||||
private HlsPlaylistFilter _hlsPlaylistFilter;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Core.Jellyfin;
|
||||
using ErsatzTV.FFmpeg.Runtime;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Jellyfin;
|
||||
@@ -27,16 +27,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -59,16 +59,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -82,15 +82,15 @@ public class JellyfinPathReplacementServiceTests
|
||||
{
|
||||
var mediaSource = new JellyfinMediaSource { OperatingSystem = "Windows" };
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = service.ReplaceNetworkPath(
|
||||
mediaSource,
|
||||
@@ -115,16 +115,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -147,16 +147,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -179,16 +179,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -211,16 +211,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -243,16 +243,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -275,16 +275,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
@@ -307,16 +307,16 @@ public class JellyfinPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetJellyfinPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetJellyfinPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new JellyfinPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<JellyfinPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<JellyfinPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementJellyfinPath(
|
||||
0,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Metadata;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Metadata;
|
||||
@@ -11,7 +11,7 @@ namespace ErsatzTV.Core.Tests.Metadata;
|
||||
public class FallbackMetadataProviderTests
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp() => _fallbackMetadataProvider = new FallbackMetadataProvider(new Mock<IClient>().Object);
|
||||
public void SetUp() => _fallbackMetadataProvider = new FallbackMetadataProvider(Substitute.For<IClient>());
|
||||
|
||||
private FallbackMetadataProvider _fallbackMetadataProvider;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Core.Plex;
|
||||
using ErsatzTV.FFmpeg.Runtime;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Plex;
|
||||
@@ -27,16 +27,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -59,16 +59,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -91,16 +91,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -123,16 +123,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -155,16 +155,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(true);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(true);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -187,16 +187,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -219,16 +219,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
@@ -251,16 +251,16 @@ public class PlexPathReplacementServiceTests
|
||||
}
|
||||
};
|
||||
|
||||
var repo = new Mock<IMediaSourceRepository>();
|
||||
repo.Setup(x => x.GetPlexPathReplacementsByLibraryId(It.IsAny<int>())).Returns(replacements.AsTask());
|
||||
IMediaSourceRepository repo = Substitute.For<IMediaSourceRepository>();
|
||||
repo.GetPlexPathReplacementsByLibraryId(Arg.Any<int>()).Returns(replacements.AsTask());
|
||||
|
||||
var runtime = new Mock<IRuntimeInfo>();
|
||||
runtime.Setup(x => x.IsOSPlatform(OSPlatform.Windows)).Returns(false);
|
||||
IRuntimeInfo runtime = Substitute.For<IRuntimeInfo>();
|
||||
runtime.IsOSPlatform(OSPlatform.Windows).Returns(false);
|
||||
|
||||
var service = new PlexPathReplacementService(
|
||||
repo.Object,
|
||||
runtime.Object,
|
||||
new Mock<ILogger<PlexPathReplacementService>>().Object);
|
||||
repo,
|
||||
runtime,
|
||||
Substitute.For<ILogger<PlexPathReplacementService>>());
|
||||
|
||||
string result = await service.GetReplacementPlexPath(
|
||||
0,
|
||||
|
||||
@@ -8,7 +8,7 @@ using ErsatzTV.Core.Scheduling;
|
||||
using ErsatzTV.Core.Tests.Fakes;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class PlayoutBuilderTests
|
||||
|
||||
ILoggerFactory loggerFactory = new LoggerFactory().AddSerilog(Log.Logger);
|
||||
|
||||
_logger = loggerFactory?.CreateLogger<PlayoutBuilder>();
|
||||
_logger = loggerFactory.CreateLogger<PlayoutBuilder>();
|
||||
}
|
||||
|
||||
private CancellationToken _cancellationToken;
|
||||
@@ -90,19 +90,16 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.FileNotFound;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(true));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(true));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
|
||||
Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, _cancellationToken);
|
||||
|
||||
configRepo.Verify();
|
||||
|
||||
result.Items.Should().BeEmpty();
|
||||
}
|
||||
|
||||
@@ -117,11 +114,10 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.FileNotFound;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(true));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(true));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
@@ -130,8 +126,6 @@ public class PlayoutBuilderTests
|
||||
|
||||
Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish, _cancellationToken);
|
||||
|
||||
configRepo.Verify();
|
||||
|
||||
result.Items.Count.Should().Be(1);
|
||||
result.Items.Head().MediaItemId.Should().Be(2);
|
||||
result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero);
|
||||
@@ -151,19 +145,16 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.Unavailable;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(true));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(true));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
|
||||
Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, _cancellationToken);
|
||||
|
||||
configRepo.Verify();
|
||||
|
||||
result.Items.Should().BeEmpty();
|
||||
}
|
||||
|
||||
@@ -178,11 +169,10 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.Unavailable;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(true));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(true));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
@@ -191,8 +181,6 @@ public class PlayoutBuilderTests
|
||||
|
||||
Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish, _cancellationToken);
|
||||
|
||||
configRepo.Verify();
|
||||
|
||||
result.Items.Count.Should().Be(1);
|
||||
result.Items.Head().MediaItemId.Should().Be(2);
|
||||
result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero);
|
||||
@@ -211,11 +199,10 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.FileNotFound;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(false));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(false));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
@@ -241,11 +228,10 @@ public class PlayoutBuilderTests
|
||||
|
||||
mediaItems[0].State = MediaItemState.Unavailable;
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
configRepo.Setup(
|
||||
repo => repo.GetValue<bool>(
|
||||
It.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key)))
|
||||
.ReturnsAsync(Some(false));
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
configRepo
|
||||
.GetValue<bool>(Arg.Is<ConfigElementKey>(k => k.Key == ConfigElementKey.PlayoutSkipMissingItems.Key))
|
||||
.Returns(Some(false));
|
||||
|
||||
(PlayoutBuilder builder, Playout playout) =
|
||||
TestDataFloodForItems(mediaItems, PlaybackOrder.Random, configRepo);
|
||||
@@ -567,18 +553,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -664,18 +651,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -809,18 +797,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -912,18 +901,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1024,18 +1014,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1129,18 +1120,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1238,18 +1230,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1352,18 +1345,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1455,18 +1449,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1569,18 +1564,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1694,18 +1690,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1811,18 +1808,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -1888,18 +1886,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -2101,18 +2100,19 @@ public class PlayoutBuilderTests
|
||||
Playout = playout
|
||||
});
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(24);
|
||||
@@ -2590,18 +2590,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -2702,18 +2703,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -2814,18 +2816,19 @@ public class PlayoutBuilderTests
|
||||
ProgramScheduleAlternates = new List<ProgramScheduleAlternate>()
|
||||
};
|
||||
|
||||
var configRepo = new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = Substitute.For<IConfigElementRepository>();
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
fakeRepository,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
DateTimeOffset start = HoursAfterMidnight(0);
|
||||
@@ -2912,7 +2915,7 @@ public class PlayoutBuilderTests
|
||||
private TestData TestDataFloodForItems(
|
||||
List<MediaItem> mediaItems,
|
||||
PlaybackOrder playbackOrder,
|
||||
Mock<IConfigElementRepository> configMock = null)
|
||||
IConfigElementRepository configMock = null)
|
||||
{
|
||||
var mediaCollection = new Collection
|
||||
{
|
||||
@@ -2920,20 +2923,21 @@ public class PlayoutBuilderTests
|
||||
MediaItems = mediaItems
|
||||
};
|
||||
|
||||
Mock<IConfigElementRepository> configRepo = configMock ?? new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = configMock ?? Substitute.For<IConfigElementRepository>();
|
||||
|
||||
var collectionRepo = new FakeMediaCollectionRepository(Map((mediaCollection.Id, mediaItems)));
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
collectionRepo,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
var items = new List<ProgramScheduleItem> { Flood(mediaCollection, playbackOrder) };
|
||||
@@ -2954,7 +2958,7 @@ public class PlayoutBuilderTests
|
||||
private TestData TestDataFloodForSmartCollectionItems(
|
||||
List<MediaItem> mediaItems,
|
||||
PlaybackOrder playbackOrder,
|
||||
Mock<IConfigElementRepository> configMock = null)
|
||||
IConfigElementRepository configMock = null)
|
||||
{
|
||||
var mediaCollection = new SmartCollection
|
||||
{
|
||||
@@ -2968,7 +2972,7 @@ public class PlayoutBuilderTests
|
||||
Query = "ghjk"
|
||||
};
|
||||
|
||||
Mock<IConfigElementRepository> configRepo = configMock ?? new Mock<IConfigElementRepository>();
|
||||
IConfigElementRepository configRepo = configMock ?? Substitute.For<IConfigElementRepository>();
|
||||
|
||||
var collectionRepo = new FakeMediaCollectionRepository(
|
||||
Map(
|
||||
@@ -2977,16 +2981,17 @@ public class PlayoutBuilderTests
|
||||
)
|
||||
);
|
||||
var televisionRepo = new FakeTelevisionRepository();
|
||||
var artistRepo = new Mock<IArtistRepository>();
|
||||
var factory = new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
var localFileSystem = new Mock<ILocalFileSystem>();
|
||||
IArtistRepository artistRepo = Substitute.For<IArtistRepository>();
|
||||
IMultiEpisodeShuffleCollectionEnumeratorFactory factory =
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>();
|
||||
ILocalFileSystem localFileSystem = Substitute.For<ILocalFileSystem>();
|
||||
var builder = new PlayoutBuilder(
|
||||
configRepo.Object,
|
||||
configRepo,
|
||||
collectionRepo,
|
||||
televisionRepo,
|
||||
artistRepo.Object,
|
||||
factory.Object,
|
||||
localFileSystem.Object,
|
||||
artistRepo,
|
||||
factory,
|
||||
localFileSystem,
|
||||
_logger);
|
||||
|
||||
var items = new List<ProgramScheduleItem> { Flood(mediaCollection, fillerCollection, playbackOrder) };
|
||||
|
||||
@@ -4,7 +4,7 @@ using ErsatzTV.Core.Interfaces.Scheduling;
|
||||
using ErsatzTV.Core.Scheduling;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
|
||||
@@ -409,10 +409,10 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase
|
||||
[Test]
|
||||
public void Should_Compare_Time_As_Local_Time()
|
||||
{
|
||||
var enumerator = new Mock<IScheduleItemsEnumerator>();
|
||||
IScheduleItemsEnumerator enumerator = Substitute.For<IScheduleItemsEnumerator>();
|
||||
|
||||
var state = new PlayoutBuilderState(
|
||||
enumerator.Object,
|
||||
enumerator,
|
||||
None,
|
||||
None,
|
||||
false,
|
||||
|
||||
@@ -3,7 +3,7 @@ using ErsatzTV.Core.Domain.Filler;
|
||||
using ErsatzTV.Core.Scheduling;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Scheduling;
|
||||
@@ -44,7 +44,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -117,7 +117,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -189,7 +189,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -258,7 +258,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -341,7 +341,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.FallbackFiller, enumerator2),
|
||||
@@ -428,7 +428,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -527,7 +527,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -637,7 +637,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -745,7 +745,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerDuration(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerDuration(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
|
||||
@@ -3,7 +3,7 @@ using ErsatzTV.Core.Domain.Filler;
|
||||
using ErsatzTV.Core.Scheduling;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Scheduling;
|
||||
@@ -50,7 +50,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -125,7 +125,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -222,7 +222,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -307,7 +307,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.PostRollFiller, enumerator2),
|
||||
@@ -395,7 +395,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -477,7 +477,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -575,7 +575,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.FallbackFiller, enumerator2),
|
||||
@@ -663,7 +663,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -771,7 +771,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -881,7 +881,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
|
||||
// hard stop at 2, an hour before the "next schedule item" at 3
|
||||
DateTimeOffset hardStop = StartState(scheduleItemsEnumerator).CurrentTime.AddHours(2);
|
||||
@@ -987,7 +987,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
|
||||
// hard stop at 2, an hour before the "next schedule item" at 3
|
||||
DateTimeOffset hardStop = StartState(scheduleItemsEnumerator).CurrentTime.AddHours(2);
|
||||
@@ -1103,7 +1103,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -1183,7 +1183,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerFlood(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerFlood(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
|
||||
@@ -3,7 +3,7 @@ using ErsatzTV.Core.Domain.Filler;
|
||||
using ErsatzTV.Core.Scheduling;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Scheduling;
|
||||
@@ -51,7 +51,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -126,7 +126,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -209,7 +209,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -308,7 +308,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.FallbackFiller, enumerator2),
|
||||
@@ -397,7 +397,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -507,7 +507,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -629,7 +629,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -715,7 +715,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
|
||||
@@ -3,7 +3,7 @@ using ErsatzTV.Core.Domain.Filler;
|
||||
using ErsatzTV.Core.Scheduling;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Core.Tests.Scheduling;
|
||||
@@ -44,7 +44,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
@@ -121,7 +121,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -195,7 +195,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -277,7 +277,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.FallbackFiller, enumerator2),
|
||||
@@ -349,7 +349,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2),
|
||||
@@ -441,7 +441,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -545,7 +545,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -631,7 +631,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -731,7 +731,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(
|
||||
@@ -816,7 +816,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase
|
||||
|
||||
PlayoutBuilderState startState = StartState(scheduleItemsEnumerator);
|
||||
|
||||
var scheduler = new PlayoutModeSchedulerOne(new Mock<ILogger>().Object);
|
||||
var scheduler = new PlayoutModeSchedulerOne(Substitute.For<ILogger>());
|
||||
(PlayoutBuilderState playoutBuilderState, List<PlayoutItem> playoutItems) = scheduler.Schedule(
|
||||
startState,
|
||||
CollectionEnumerators(scheduleItem, enumerator),
|
||||
|
||||
@@ -18,7 +18,7 @@ using LanguageExt.UnsafeValueAccess;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
@@ -91,7 +91,7 @@ public class ScheduleIntegrationTests
|
||||
|
||||
services.AddSingleton<ISearchIndex, SearchIndex>();
|
||||
|
||||
services.AddSingleton(_ => new Mock<IClient>().Object);
|
||||
services.AddSingleton(_ => Substitute.For<IClient>());
|
||||
|
||||
ServiceProvider provider = services.BuildServiceProvider();
|
||||
|
||||
@@ -117,11 +117,11 @@ public class ScheduleIntegrationTests
|
||||
|
||||
var builder = new PlayoutBuilder(
|
||||
new ConfigElementRepository(factory),
|
||||
new MediaCollectionRepository(new Mock<IClient>().Object, searchIndex, factory),
|
||||
new MediaCollectionRepository(Substitute.For<IClient>(), searchIndex, factory),
|
||||
new TelevisionRepository(factory, provider.GetRequiredService<ILogger<TelevisionRepository>>()),
|
||||
new ArtistRepository(factory),
|
||||
new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>().Object,
|
||||
new Mock<ILocalFileSystem>().Object,
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>(),
|
||||
Substitute.For<ILocalFileSystem>(),
|
||||
provider.GetRequiredService<ILogger<PlayoutBuilder>>());
|
||||
|
||||
{
|
||||
@@ -287,11 +287,11 @@ public class ScheduleIntegrationTests
|
||||
|
||||
var builder = new PlayoutBuilder(
|
||||
new ConfigElementRepository(factory),
|
||||
new MediaCollectionRepository(new Mock<IClient>().Object, new Mock<ISearchIndex>().Object, factory),
|
||||
new MediaCollectionRepository(Substitute.For<IClient>(), Substitute.For<ISearchIndex>(), factory),
|
||||
new TelevisionRepository(factory, provider.GetRequiredService<ILogger<TelevisionRepository>>()),
|
||||
new ArtistRepository(factory),
|
||||
new Mock<IMultiEpisodeShuffleCollectionEnumeratorFactory>().Object,
|
||||
new Mock<ILocalFileSystem>().Object,
|
||||
Substitute.For<IMultiEpisodeShuffleCollectionEnumeratorFactory>(),
|
||||
Substitute.For<ILocalFileSystem>(),
|
||||
provider.GetRequiredService<ILogger<PlayoutBuilder>>());
|
||||
|
||||
for (var i = 0; i <= 24 * 4; i++)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
<PackageReference Include="NSubstitute" Version="5.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
|
||||
|
||||
@@ -10,7 +10,7 @@ using ErsatzTV.FFmpeg.State;
|
||||
using FluentAssertions;
|
||||
using LanguageExt;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using static LanguageExt.Prelude;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ErsatzTV.FFmpeg.Tests;
|
||||
[TestFixture]
|
||||
public class PipelineBuilderBaseTests
|
||||
{
|
||||
private readonly ILogger _logger = new Mock<ILogger>().Object;
|
||||
private readonly ILogger _logger = Substitute.For<ILogger>();
|
||||
|
||||
[Test]
|
||||
public void Incorrect_Video_Codec_Should_Use_Encoder()
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Infrastructure.Data.Repositories.Caching;
|
||||
using FluentAssertions;
|
||||
using LanguageExt;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Infrastructure.Tests.Data.Repositories.Caching;
|
||||
@@ -18,11 +18,11 @@ public class CachingSearchRepositoryTests
|
||||
var englishResult = new List<string> { "english_result" };
|
||||
var frenchResult = new List<string> { "french_result" };
|
||||
|
||||
var searchRepo = new Mock<ISearchRepository>();
|
||||
searchRepo.Setup(x => x.GetAllLanguageCodes(englishMediaCodes)).Returns(englishResult.AsTask());
|
||||
searchRepo.Setup(x => x.GetAllLanguageCodes(frenchMediaCodes)).Returns(frenchResult.AsTask());
|
||||
ISearchRepository searchRepo = Substitute.For<ISearchRepository>();
|
||||
searchRepo.GetAllLanguageCodes(englishMediaCodes).Returns(englishResult.AsTask());
|
||||
searchRepo.GetAllLanguageCodes(frenchMediaCodes).Returns(frenchResult.AsTask());
|
||||
|
||||
var repo = new CachingSearchRepository(searchRepo.Object);
|
||||
var repo = new CachingSearchRepository(searchRepo);
|
||||
|
||||
List<string> result1 = await repo.GetAllLanguageCodes(englishMediaCodes);
|
||||
result1.Should().BeEquivalentTo(englishResult);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
<PackageReference Include="NSubstitute" Version="5.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
|
||||
|
||||
@@ -28,7 +28,7 @@ using ErsatzTV.Scanner.Core.Metadata;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
using MediaStream = ErsatzTV.Core.Domain.MediaStream;
|
||||
@@ -215,26 +215,25 @@ public class TranscodingTests
|
||||
HardwareAccelerationKind profileAcceleration)
|
||||
{
|
||||
var localFileSystem = new LocalFileSystem(
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
LoggerFactory.CreateLogger<LocalFileSystem>());
|
||||
var tempFilePool = new TempFilePool();
|
||||
|
||||
var mockImageCache = new Mock<ImageCache>(localFileSystem, tempFilePool);
|
||||
ImageCache mockImageCache = Substitute.For<ImageCache>(localFileSystem, tempFilePool);
|
||||
|
||||
// always return the static watermark resource
|
||||
mockImageCache.Setup(
|
||||
ic => ic.GetPathForImage(
|
||||
It.IsAny<string>(),
|
||||
It.Is<ArtworkKind>(x => x == ArtworkKind.Watermark),
|
||||
It.IsAny<Option<int>>()))
|
||||
mockImageCache.GetPathForImage(
|
||||
Arg.Any<string>(),
|
||||
Arg.Is<ArtworkKind>(x => x == ArtworkKind.Watermark),
|
||||
Arg.Any<Option<int>>())
|
||||
.Returns(Path.Combine(TestContext.CurrentContext.TestDirectory, "Resources", "ErsatzTV.png"));
|
||||
|
||||
var oldService = new FFmpegProcessService(
|
||||
new FFmpegPlaybackSettingsCalculator(),
|
||||
new FakeStreamSelector(),
|
||||
mockImageCache.Object,
|
||||
mockImageCache,
|
||||
tempFilePool,
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
MemoryCache,
|
||||
LoggerFactory.CreateLogger<FFmpegProcessService>());
|
||||
|
||||
@@ -250,10 +249,10 @@ public class TranscodingTests
|
||||
MemoryCache,
|
||||
LoggerFactory.CreateLogger<HardwareCapabilitiesFactory>()),
|
||||
LoggerFactory.CreateLogger<PipelineBuilderFactory>()),
|
||||
new Mock<IConfigElementRepository>().Object,
|
||||
Substitute.For<IConfigElementRepository>(),
|
||||
LoggerFactory.CreateLogger<FFmpegLibraryProcessService>());
|
||||
|
||||
var songVideoGenerator = new SongVideoGenerator(tempFilePool, mockImageCache.Object, service);
|
||||
var songVideoGenerator = new SongVideoGenerator(tempFilePool, mockImageCache, service);
|
||||
|
||||
var channel = new Channel(Guid.NewGuid())
|
||||
{
|
||||
@@ -304,12 +303,12 @@ public class TranscodingTests
|
||||
ExecutableName("ffprobe"),
|
||||
CancellationToken.None);
|
||||
|
||||
var metadataRepository = new Mock<IMetadataRepository>();
|
||||
metadataRepository
|
||||
.Setup(r => r.UpdateStatistics(It.IsAny<MediaItem>(), It.IsAny<MediaVersion>(), It.IsAny<bool>()))
|
||||
.Callback<MediaItem, MediaVersion, bool>(
|
||||
(_, version, _) =>
|
||||
IMetadataRepository metadataRepository = Substitute.For<IMetadataRepository>();
|
||||
metadataRepository.When(x => x.UpdateStatistics(Arg.Any<MediaItem>(), Arg.Any<MediaVersion>(), Arg.Any<bool>()))
|
||||
.Do(
|
||||
x =>
|
||||
{
|
||||
MediaVersion version = x.Arg<MediaVersion>();
|
||||
if (version.Streams.Any(s => s.MediaStreamKind == MediaStreamKind.Video && s.AttachedPic == false))
|
||||
{
|
||||
version.MediaFiles = videoVersion.MediaFiles;
|
||||
@@ -323,9 +322,9 @@ public class TranscodingTests
|
||||
});
|
||||
|
||||
var localStatisticsProvider = new LocalStatisticsProvider(
|
||||
metadataRepository.Object,
|
||||
new LocalFileSystem(new Mock<IClient>().Object, LoggerFactory.CreateLogger<LocalFileSystem>()),
|
||||
new Mock<IClient>().Object,
|
||||
metadataRepository,
|
||||
new LocalFileSystem(Substitute.For<IClient>(), LoggerFactory.CreateLogger<LocalFileSystem>()),
|
||||
Substitute.For<IClient>(),
|
||||
LoggerFactory.CreateLogger<LocalStatisticsProvider>());
|
||||
|
||||
await localStatisticsProvider.RefreshStatistics(ExecutableName("ffmpeg"), ExecutableName("ffprobe"), song);
|
||||
@@ -434,20 +433,21 @@ public class TranscodingTests
|
||||
Streams = new List<MediaStream>()
|
||||
};
|
||||
|
||||
var metadataRepository = new Mock<IMetadataRepository>();
|
||||
IMetadataRepository? metadataRepository = Substitute.For<IMetadataRepository>();
|
||||
metadataRepository
|
||||
.Setup(r => r.UpdateStatistics(It.IsAny<MediaItem>(), It.IsAny<MediaVersion>(), It.IsAny<bool>()))
|
||||
.Callback<MediaItem, MediaVersion, bool>(
|
||||
(_, version, _) =>
|
||||
.When(r => r.UpdateStatistics(Arg.Any<MediaItem>(), Arg.Any<MediaVersion>(), Arg.Any<bool>()))
|
||||
.Do(
|
||||
args =>
|
||||
{
|
||||
MediaVersion? version = args.Arg<MediaVersion>();
|
||||
version.MediaFiles = v.MediaFiles;
|
||||
v = version;
|
||||
});
|
||||
|
||||
var localStatisticsProvider = new LocalStatisticsProvider(
|
||||
metadataRepository.Object,
|
||||
new LocalFileSystem(new Mock<IClient>().Object, LoggerFactory.CreateLogger<LocalFileSystem>()),
|
||||
new Mock<IClient>().Object,
|
||||
metadataRepository,
|
||||
new LocalFileSystem(Substitute.For<IClient>(), LoggerFactory.CreateLogger<LocalFileSystem>()),
|
||||
Substitute.For<IClient>(),
|
||||
LoggerFactory.CreateLogger<LocalStatisticsProvider>());
|
||||
|
||||
await localStatisticsProvider.RefreshStatistics(
|
||||
@@ -837,22 +837,21 @@ public class TranscodingTests
|
||||
|
||||
private static FFmpegLibraryProcessService GetService()
|
||||
{
|
||||
var imageCache = new Mock<IImageCache>();
|
||||
IImageCache? imageCache = Substitute.For<IImageCache>();
|
||||
|
||||
// always return the static watermark resource
|
||||
imageCache.Setup(
|
||||
ic => ic.GetPathForImage(
|
||||
It.IsAny<string>(),
|
||||
It.Is<ArtworkKind>(x => x == ArtworkKind.Watermark),
|
||||
It.IsAny<Option<int>>()))
|
||||
imageCache.GetPathForImage(
|
||||
Arg.Any<string>(),
|
||||
Arg.Is<ArtworkKind>(x => x == ArtworkKind.Watermark),
|
||||
Arg.Any<Option<int>>())
|
||||
.Returns(Path.Combine(TestContext.CurrentContext.TestDirectory, "Resources", "ErsatzTV.png"));
|
||||
|
||||
var oldService = new FFmpegProcessService(
|
||||
new FFmpegPlaybackSettingsCalculator(),
|
||||
new FakeStreamSelector(),
|
||||
imageCache.Object,
|
||||
new Mock<ITempFilePool>().Object,
|
||||
new Mock<IClient>().Object,
|
||||
imageCache,
|
||||
Substitute.For<ITempFilePool>(),
|
||||
Substitute.For<IClient>(),
|
||||
MemoryCache,
|
||||
LoggerFactory.CreateLogger<FFmpegProcessService>());
|
||||
|
||||
@@ -860,7 +859,7 @@ public class TranscodingTests
|
||||
oldService,
|
||||
new FFmpegPlaybackSettingsCalculator(),
|
||||
new FakeStreamSelector(),
|
||||
new Mock<ITempFilePool>().Object,
|
||||
Substitute.For<ITempFilePool>(),
|
||||
new PipelineBuilderFactory(
|
||||
new RuntimeInfo(),
|
||||
//new FakeNvidiaCapabilitiesFactory(),
|
||||
@@ -868,7 +867,7 @@ public class TranscodingTests
|
||||
MemoryCache,
|
||||
LoggerFactory.CreateLogger<HardwareCapabilitiesFactory>()),
|
||||
LoggerFactory.CreateLogger<PipelineBuilderFactory>()),
|
||||
new Mock<IConfigElementRepository>().Object,
|
||||
Substitute.For<IConfigElementRepository>(),
|
||||
LoggerFactory.CreateLogger<FFmpegLibraryProcessService>());
|
||||
|
||||
return service;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Scanner.Core.Metadata;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata;
|
||||
@@ -19,10 +19,10 @@ public class LocalStatisticsProviderTests
|
||||
public void Test()
|
||||
{
|
||||
var provider = new LocalStatisticsProvider(
|
||||
new Mock<IMetadataRepository>().Object,
|
||||
new Mock<ILocalFileSystem>().Object,
|
||||
new Mock<IClient>().Object,
|
||||
new Mock<ILogger<LocalStatisticsProvider>>().Object);
|
||||
Substitute.For<IMetadataRepository>(),
|
||||
Substitute.For<ILocalFileSystem>(),
|
||||
Substitute.For<IClient>(),
|
||||
Substitute.For<ILogger<LocalStatisticsProvider>>());
|
||||
|
||||
var input = new LocalStatisticsProvider.FFprobe(
|
||||
new LocalStatisticsProvider.FFprobeFormat(
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata;
|
||||
using ErsatzTV.Scanner.Tests.Core.Fakes;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata;
|
||||
@@ -45,10 +45,10 @@ public class LocalSubtitlesProviderTests
|
||||
};
|
||||
|
||||
var provider = new LocalSubtitlesProvider(
|
||||
new Mock<IMediaItemRepository>().Object,
|
||||
new Mock<IMetadataRepository>().Object,
|
||||
Substitute.For<IMediaItemRepository>(),
|
||||
Substitute.For<IMetadataRepository>(),
|
||||
new FakeLocalFileSystem(fakeFiles),
|
||||
new Mock<ILogger<LocalSubtitlesProvider>>().Object);
|
||||
Substitute.For<ILogger<LocalSubtitlesProvider>>());
|
||||
|
||||
List<Subtitle> result = provider.LocateExternalSubtitles(
|
||||
cultures,
|
||||
@@ -86,10 +86,10 @@ public class LocalSubtitlesProviderTests
|
||||
};
|
||||
|
||||
var provider = new LocalSubtitlesProvider(
|
||||
new Mock<IMediaItemRepository>().Object,
|
||||
new Mock<IMetadataRepository>().Object,
|
||||
Substitute.For<IMediaItemRepository>(),
|
||||
Substitute.For<IMetadataRepository>(),
|
||||
new FakeLocalFileSystem(fakeFiles),
|
||||
new Mock<ILogger<LocalSubtitlesProvider>>().Object);
|
||||
Substitute.For<ILogger<LocalSubtitlesProvider>>());
|
||||
|
||||
List<Subtitle> result = provider.LocateExternalSubtitles(
|
||||
cultures,
|
||||
|
||||
@@ -13,7 +13,7 @@ using ErsatzTV.Scanner.Tests.Core.Fakes;
|
||||
using FluentAssertions;
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata;
|
||||
@@ -43,42 +43,42 @@ public class MovieFolderScannerTests
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_movieRepository = new Mock<IMovieRepository>();
|
||||
_movieRepository.Setup(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()))
|
||||
_movieRepository = Substitute.For<IMovieRepository>();
|
||||
_movieRepository.GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>())
|
||||
.Returns(
|
||||
(LibraryPath _, string path) =>
|
||||
Right<BaseError, MediaItemScanResult<Movie>>(new FakeMovieWithPath(path)).AsTask());
|
||||
_movieRepository.Setup(x => x.FindMoviePaths(It.IsAny<LibraryPath>()))
|
||||
args =>
|
||||
Right<BaseError, MediaItemScanResult<Movie>>(new FakeMovieWithPath(args.Arg<string>()))
|
||||
.AsTask());
|
||||
_movieRepository.FindMoviePaths(Arg.Any<LibraryPath>())
|
||||
.Returns(new List<string>().AsEnumerable().AsTask());
|
||||
|
||||
_mediaItemRepository = new Mock<IMediaItemRepository>();
|
||||
_mediaItemRepository.Setup(x => x.FlagFileNotFound(It.IsAny<LibraryPath>(), It.IsAny<string>()))
|
||||
_mediaItemRepository = Substitute.For<IMediaItemRepository>();
|
||||
_mediaItemRepository.FlagFileNotFound(Arg.Any<LibraryPath>(), Arg.Any<string>())
|
||||
.Returns(new List<int>().AsTask());
|
||||
|
||||
_localStatisticsProvider = new Mock<ILocalStatisticsProvider>();
|
||||
_localMetadataProvider = new Mock<ILocalMetadataProvider>();
|
||||
_localStatisticsProvider = Substitute.For<ILocalStatisticsProvider>();
|
||||
_localMetadataProvider = Substitute.For<ILocalMetadataProvider>();
|
||||
|
||||
_localStatisticsProvider.Setup(
|
||||
x => x.RefreshStatistics(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MediaItem>()))
|
||||
.Returns<string, string, MediaItem>((_, _, _) => Right<BaseError, bool>(true).AsTask());
|
||||
_localStatisticsProvider.RefreshStatistics(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<MediaItem>())
|
||||
.Returns(Right<BaseError, bool>(true).AsTask());
|
||||
|
||||
// fallback metadata adds metadata to a movie, so we need to replicate that here
|
||||
_localMetadataProvider.Setup(x => x.RefreshFallbackMetadata(It.IsAny<Movie>()))
|
||||
_localMetadataProvider.RefreshFallbackMetadata(Arg.Any<Movie>())
|
||||
.Returns(
|
||||
(MediaItem mediaItem) =>
|
||||
arg =>
|
||||
{
|
||||
((Movie)mediaItem).MovieMetadata = new List<MovieMetadata> { new() };
|
||||
((Movie)arg.Arg<MediaItem>()).MovieMetadata = new List<MovieMetadata> { new() };
|
||||
return Task.FromResult(true);
|
||||
});
|
||||
|
||||
_imageCache = new Mock<IImageCache>();
|
||||
_imageCache = Substitute.For<IImageCache>();
|
||||
}
|
||||
|
||||
private Mock<IMovieRepository> _movieRepository;
|
||||
private Mock<IMediaItemRepository> _mediaItemRepository;
|
||||
private Mock<ILocalStatisticsProvider> _localStatisticsProvider;
|
||||
private Mock<ILocalMetadataProvider> _localMetadataProvider;
|
||||
private Mock<IImageCache> _imageCache;
|
||||
private IMovieRepository _movieRepository;
|
||||
private IMediaItemRepository _mediaItemRepository;
|
||||
private ILocalStatisticsProvider _localStatisticsProvider;
|
||||
private ILocalMetadataProvider _localMetadataProvider;
|
||||
private IImageCache _imageCache;
|
||||
|
||||
[Test]
|
||||
public async Task NewMovie_Statistics_And_FallbackMetadata(
|
||||
@@ -105,20 +105,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -150,20 +146,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -194,21 +186,17 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshSidecarMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath),
|
||||
metadataPath),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshSidecarMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath),
|
||||
metadataPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -239,21 +227,17 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshSidecarMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath),
|
||||
metadataPath),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshSidecarMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath),
|
||||
metadataPath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -288,24 +272,18 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_imageCache.Verify(
|
||||
x => x.CopyArtworkToCache(posterPath, ArtworkKind.Poster),
|
||||
Times.Once);
|
||||
await _imageCache.Received(1).CopyArtworkToCache(posterPath, ArtworkKind.Poster);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -340,24 +318,18 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_imageCache.Verify(
|
||||
x => x.CopyArtworkToCache(posterPath, ArtworkKind.Poster),
|
||||
Times.Once);
|
||||
await _imageCache.Received(1).CopyArtworkToCache(posterPath, ArtworkKind.Poster);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -392,24 +364,18 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_imageCache.Verify(
|
||||
x => x.CopyArtworkToCache(posterPath, ArtworkKind.Poster),
|
||||
Times.Once);
|
||||
await _imageCache.Received(1).CopyArtworkToCache(posterPath, ArtworkKind.Poster);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -443,20 +409,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -488,20 +450,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -535,20 +493,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -576,20 +530,16 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_movieRepository.Verify(x => x.GetOrAdd(It.IsAny<LibraryPath>(), It.IsAny<string>()), Times.Once);
|
||||
_movieRepository.Verify(x => x.GetOrAdd(libraryPath, moviePath), Times.Once);
|
||||
await _movieRepository.Received(1).GetOrAdd(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _movieRepository.Received(1).GetOrAdd(libraryPath, moviePath);
|
||||
|
||||
_localStatisticsProvider.Verify(
|
||||
x => x.RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localStatisticsProvider.Received(1).RefreshStatistics(
|
||||
FFmpegPath,
|
||||
FFprobePath,
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
|
||||
_localMetadataProvider.Verify(
|
||||
x => x.RefreshFallbackMetadata(
|
||||
It.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)),
|
||||
Times.Once);
|
||||
await _localMetadataProvider.Received(1).RefreshFallbackMetadata(
|
||||
Arg.Is<Movie>(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -601,7 +551,7 @@ public class MovieFolderScannerTests
|
||||
string movieFolder = Path.Combine(FakeRoot, "Movie (2020)");
|
||||
string oldMoviePath = Path.Combine(movieFolder, "Movie (2020).avi");
|
||||
|
||||
_movieRepository.Setup(x => x.FindMoviePaths(It.IsAny<LibraryPath>()))
|
||||
_movieRepository.FindMoviePaths(Arg.Any<LibraryPath>())
|
||||
.Returns(new List<string> { oldMoviePath }.AsEnumerable().AsTask());
|
||||
|
||||
string moviePath = Path.Combine(movieFolder, "Movie (2020).mkv");
|
||||
@@ -622,10 +572,8 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_mediaItemRepository.Verify(
|
||||
x => x.FlagFileNotFound(It.IsAny<LibraryPath>(), It.IsAny<string>()),
|
||||
Times.Once);
|
||||
_mediaItemRepository.Verify(x => x.FlagFileNotFound(libraryPath, oldMoviePath), Times.Once);
|
||||
await _mediaItemRepository.Received(1).FlagFileNotFound(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _mediaItemRepository.Received(1).FlagFileNotFound(libraryPath, oldMoviePath);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -634,7 +582,7 @@ public class MovieFolderScannerTests
|
||||
string movieFolder = Path.Combine(FakeRoot, "Movie (2020)");
|
||||
string oldMoviePath = Path.Combine(movieFolder, "Movie (2020).avi");
|
||||
|
||||
_movieRepository.Setup(x => x.FindMoviePaths(It.IsAny<LibraryPath>()))
|
||||
_movieRepository.FindMoviePaths(Arg.Any<LibraryPath>())
|
||||
.Returns(new List<string> { oldMoviePath }.AsEnumerable().AsTask());
|
||||
|
||||
MovieFolderScanner service = GetService(
|
||||
@@ -653,46 +601,44 @@ public class MovieFolderScannerTests
|
||||
|
||||
result.IsRight.Should().BeTrue();
|
||||
|
||||
_mediaItemRepository.Verify(
|
||||
x => x.FlagFileNotFound(It.IsAny<LibraryPath>(), It.IsAny<string>()),
|
||||
Times.Once);
|
||||
_mediaItemRepository.Verify(x => x.FlagFileNotFound(libraryPath, oldMoviePath), Times.Once);
|
||||
await _mediaItemRepository.Received(1).FlagFileNotFound(Arg.Any<LibraryPath>(), Arg.Any<string>());
|
||||
await _mediaItemRepository.Received(1).FlagFileNotFound(libraryPath, oldMoviePath);
|
||||
}
|
||||
|
||||
private MovieFolderScanner GetService(params FakeFileEntry[] files) =>
|
||||
new(
|
||||
new FakeLocalFileSystem(new List<FakeFileEntry>(files)),
|
||||
_movieRepository.Object,
|
||||
_localStatisticsProvider.Object,
|
||||
new Mock<ILocalSubtitlesProvider>().Object,
|
||||
_localMetadataProvider.Object,
|
||||
new Mock<IMetadataRepository>().Object,
|
||||
_imageCache.Object,
|
||||
new Mock<ILibraryRepository>().Object,
|
||||
_mediaItemRepository.Object,
|
||||
new Mock<IMediator>().Object,
|
||||
new Mock<IFFmpegPngService>().Object,
|
||||
new Mock<ITempFilePool>().Object,
|
||||
new Mock<IClient>().Object,
|
||||
new Mock<ILogger<MovieFolderScanner>>().Object
|
||||
_movieRepository,
|
||||
_localStatisticsProvider,
|
||||
Substitute.For<ILocalSubtitlesProvider>(),
|
||||
_localMetadataProvider,
|
||||
Substitute.For<IMetadataRepository>(),
|
||||
_imageCache,
|
||||
Substitute.For<ILibraryRepository>(),
|
||||
_mediaItemRepository,
|
||||
Substitute.For<IMediator>(),
|
||||
Substitute.For<IFFmpegPngService>(),
|
||||
Substitute.For<ITempFilePool>(),
|
||||
Substitute.For<IClient>(),
|
||||
Substitute.For<ILogger<MovieFolderScanner>>()
|
||||
);
|
||||
|
||||
private MovieFolderScanner GetService(params FakeFolderEntry[] folders) =>
|
||||
new(
|
||||
new FakeLocalFileSystem(new List<FakeFileEntry>(), new List<FakeFolderEntry>(folders)),
|
||||
_movieRepository.Object,
|
||||
_localStatisticsProvider.Object,
|
||||
new Mock<ILocalSubtitlesProvider>().Object,
|
||||
_localMetadataProvider.Object,
|
||||
new Mock<IMetadataRepository>().Object,
|
||||
_imageCache.Object,
|
||||
new Mock<ILibraryRepository>().Object,
|
||||
_mediaItemRepository.Object,
|
||||
new Mock<IMediator>().Object,
|
||||
new Mock<IFFmpegPngService>().Object,
|
||||
new Mock<ITempFilePool>().Object,
|
||||
new Mock<IClient>().Object,
|
||||
new Mock<ILogger<MovieFolderScanner>>().Object
|
||||
_movieRepository,
|
||||
_localStatisticsProvider,
|
||||
Substitute.For<ILocalSubtitlesProvider>(),
|
||||
_localMetadataProvider,
|
||||
Substitute.For<IMetadataRepository>(),
|
||||
_imageCache,
|
||||
Substitute.For<ILibraryRepository>(),
|
||||
_mediaItemRepository,
|
||||
Substitute.For<IMediator>(),
|
||||
Substitute.For<IFFmpegPngService>(),
|
||||
Substitute.For<ITempFilePool>(),
|
||||
Substitute.For<IClient>(),
|
||||
Substitute.For<ILogger<MovieFolderScanner>>()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class ArtistNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _artistNfoReader = new ArtistNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
_logger);
|
||||
|
||||
private readonly ILogger<ArtistNfoReader> _logger;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
using Serilog;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class EpisodeNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _episodeNfoReader = new EpisodeNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
_logger);
|
||||
|
||||
private readonly ILogger<EpisodeNfoReader> _logger;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata.Nfo;
|
||||
@@ -16,7 +16,7 @@ public class MovieNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _movieNfoReader = new MovieNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
new NullLogger<MovieNfoReader>());
|
||||
|
||||
private MovieNfoReader _movieNfoReader;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata.Nfo;
|
||||
@@ -16,7 +16,7 @@ public class MusicVideoNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _musicVideoNfoReader = new MusicVideoNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
new NullLogger<MusicVideoNfoReader>());
|
||||
|
||||
private MusicVideoNfoReader _musicVideoNfoReader;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata.Nfo;
|
||||
@@ -16,7 +16,7 @@ public class OtherVideoNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _otherVideoNfoReader = new OtherVideoNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
new NullLogger<OtherVideoNfoReader>());
|
||||
|
||||
private OtherVideoNfoReader _otherVideoNfoReader;
|
||||
|
||||
@@ -5,7 +5,7 @@ using ErsatzTV.Scanner.Core.Metadata.Nfo;
|
||||
using FluentAssertions;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.IO;
|
||||
using Moq;
|
||||
using NSubstitute;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.Scanner.Tests.Core.Metadata.Nfo;
|
||||
@@ -16,7 +16,7 @@ public class ShowNfoReaderTests
|
||||
[SetUp]
|
||||
public void SetUp() => _showNfoReader = new ShowNfoReader(
|
||||
new RecyclableMemoryStreamManager(),
|
||||
new Mock<IClient>().Object,
|
||||
Substitute.For<IClient>(),
|
||||
new NullLogger<ShowNfoReader>());
|
||||
|
||||
private ShowNfoReader _showNfoReader;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<PackageReference Include="FluentAssertions" Version="6.11.0" />
|
||||
<PackageReference Include="LanguageExt.Core" Version="4.4.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
|
||||
<PackageReference Include="Moq" Version="4.18.4" />
|
||||
<PackageReference Include="NSubstitute" Version="5.0.0" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
|
||||
|
||||
Reference in New Issue
Block a user