1
- using NUnit . Framework ;
2
-
3
1
using Moq ;
2
+ using NuciLog . Core ;
3
+ using NUnit . Framework ;
4
4
5
5
using IptvPlaylistAggregator . Configuration ;
6
6
using IptvPlaylistAggregator . Service ;
7
7
8
- using NuciLog . Core ;
9
-
10
- namespace IptvPlaylistAggregator . UnitTests . Service . Models
8
+ namespace IptvPlaylistAggregator . UnitTests . Service
11
9
{
12
10
public sealed class MediaSourceCheckerTests
13
11
{
14
- Mock < IFileDownloader > fileDownloaderMock ;
15
- Mock < IPlaylistFileBuilder > playlistFileBuilderMock ;
16
- Mock < ICacheManager > cacheMock ;
17
- Mock < ILogger > loggerMock ;
18
- ApplicationSettings applicationSettings ;
12
+ private Mock < IFileDownloader > fileDownloaderMock ;
13
+ private Mock < IPlaylistFileBuilder > playlistFileBuilderMock ;
14
+ private Mock < ICacheManager > cacheMock ;
15
+ private Mock < ILogger > loggerMock ;
16
+ private ApplicationSettings applicationSettings ;
19
17
20
- IMediaSourceChecker mediaSourceChecker ;
18
+ private MediaSourceChecker mediaSourceChecker ;
21
19
22
20
[ SetUp ]
23
21
public void SetUp ( )
24
22
{
25
- fileDownloaderMock = new Mock < IFileDownloader > ( ) ;
26
- playlistFileBuilderMock = new Mock < IPlaylistFileBuilder > ( ) ;
27
- cacheMock = new Mock < ICacheManager > ( ) ;
28
- loggerMock = new Mock < ILogger > ( ) ;
29
- applicationSettings = new ApplicationSettings ( ) ;
23
+ fileDownloaderMock = new ( ) ;
24
+ playlistFileBuilderMock = new ( ) ;
25
+ cacheMock = new ( ) ;
26
+ loggerMock = new ( ) ;
27
+ applicationSettings = new ( ) ;
30
28
31
- mediaSourceChecker = new MediaSourceChecker (
29
+ mediaSourceChecker = new (
32
30
fileDownloaderMock . Object ,
33
31
playlistFileBuilderMock . Object ,
34
32
cacheMock . Object ,
@@ -39,42 +37,31 @@ public void SetUp()
39
37
[ TestCase ( "https://www.youtube.com/watch?v=fxFIgBld95E" ) ]
40
38
[ Test ]
41
39
public void GivenTheSourceIsYouTubeVideo_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
42
- {
43
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
44
- }
40
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
45
41
46
42
[ TestCase ( "https://dotto.edvr.ro/dottotv_1603019528.mp4" ) ]
47
43
[ TestCase ( "https://iptvcat.com/assets/videos/lazycat-iptvcat.com.mp4?fluxustv.m3u8" ) ]
48
44
[ TestCase ( "https://iptvcat.com/assets/videos/lazycat-iptvcat.com.mp4" ) ]
49
45
[ Test ]
50
46
public void GivenTheSourceIsShortenedUrl_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
51
- {
52
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
53
- }
47
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
54
48
55
49
[ TestCase ( "https://tinyurl.com/y9k7rbje" ) ]
56
50
[ Test ]
57
51
public void GivenTheSourceIsAnMP4File_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
58
- {
59
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
60
- }
52
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
61
53
62
54
[ TestCase ( "mms://86.34.169.52:8080/" ) ]
63
55
[ TestCase ( "mms://musceltvlive.muscel.ro:8080" ) ]
64
56
[ Test ]
65
57
public void GivenTheSourceIsUsingTeMmsProtocol_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
66
- {
67
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
68
- }
69
-
58
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
70
59
71
60
[ TestCase ( "mmsh://82.137.6.58:1234/" ) ]
72
61
[ TestCase ( "mmsh://musceltvlive.muscel.ro:8080" ) ]
73
62
[ Test ]
74
63
public void GivenTheSourceIsUsingTeMmshProtocol_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
75
- {
76
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
77
- }
64
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
78
65
79
66
[ TestCase ( "rtmp://212.0.209.209:1935/live/_definst_mp4:Moldova" ) ]
80
67
[ TestCase ( "rtmp://81.18.66.155/live/banat-tv" ) ]
@@ -93,9 +80,7 @@ public void GivenTheSourceIsUsingTeMmshProtocol_WhenCheckingThatItIsPlayable_The
93
80
[ TestCase ( "rtmp://v1.arya.ro:1935/live/ptv1.flv" ) ]
94
81
[ Test ]
95
82
public void GivenTheSourceIsUsingTeRtmpProtocol_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
96
- {
97
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
98
- }
83
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
99
84
100
85
[ TestCase ( "rtsp://195.64.178.23/somax" ) ]
101
86
[ TestCase ( "rtsp://195.64.178.23/telem" ) ]
@@ -104,17 +89,9 @@ public void GivenTheSourceIsUsingTeRtmpProtocol_WhenCheckingThatItIsPlayable_The
104
89
[ TestCase ( "rtsp://live.trm.md:1935/live/M1Mlive" ) ]
105
90
[ Test ]
106
91
public void GivenTheSourceIsUsingTeRtspProtocol_WhenCheckingThatItIsPlayable_ThenFalseIsReturned ( string sourceUrl )
107
- {
108
- AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
109
- }
92
+ => AssertThatSourceUrlIsNotPlayable ( sourceUrl ) ;
110
93
111
- void AssertThatSourceUrlIsNotPlayable ( string sourceUrl )
112
- {
113
- // Act
114
- bool sourceIsPlayale = mediaSourceChecker . IsSourcePlayableAsync ( sourceUrl ) . Result ;
115
-
116
- // Assert
117
- Assert . That ( sourceIsPlayale , Is . False ) ;
118
- }
94
+ private void AssertThatSourceUrlIsNotPlayable ( string sourceUrl )
95
+ => Assert . That ( ! mediaSourceChecker . IsSourcePlayableAsync ( sourceUrl ) . Result ) ;
119
96
}
120
97
}
0 commit comments