public void duration_queryable() { Assert.Throws<ArgumentNullException>(() => ((IQueryable<Script>)null).Duration()); var scripts = new[] { new Script { Duration = 1 }, new Script { Duration = 2 } }.AsQueryable(); Assert.Equal(2, scripts.Duration().Count()); Assert.Equal(2, scripts.Duration(0).Count()); Assert.Empty(scripts.Duration(3)); Assert.Equal(1, scripts.Duration(0, 1).Count()); Assert.Equal(2, scripts.Duration(1, 2).Count()); Assert.Empty(scripts.Duration(to: 0)); Assert.Equal(1, scripts.Duration(to: 1).Count()); Assert.Equal(2, scripts.Duration(to: 3).Count()); }
public void duration_enumerable() { Assert.Throws<ArgumentNullException>(() => ((IEnumerable<Script>)null).Duration()); var downloads = new[] { null, new Script(), new Script { Duration = 1 }, new Script { Duration = 2 } }; Assert.Equal(3, downloads.Duration().Count()); Assert.Equal(2, downloads.Duration(0).Count()); Assert.Empty(downloads.Duration(3)); Assert.Equal(1, downloads.Duration(0, 1).Count()); Assert.Equal(2, downloads.Duration(1, 2).Count()); Assert.Empty(downloads.Duration(to: 0)); Assert.Equal(1, downloads.Duration(to: 1).Count()); Assert.Equal(2, downloads.Duration(to: 3).Count()); }
public void duration_enumerable() { Assert.Throws<ArgumentNullException>(() => ((IEnumerable<Media>)null).Duration()); var medias = new[] { null, new Media(), new Media { Duration = 1 }, new Media { Duration = 2 } }; Assert.Equal(3, medias.Duration().Count()); Assert.Equal(2, medias.Duration(0).Count()); Assert.Empty(medias.Duration(3)); Assert.Equal(1, medias.Duration(0, 1).Count()); Assert.Equal(2, medias.Duration(1, 2).Count()); Assert.Empty(medias.Duration(to: 0)); Assert.Equal(1, medias.Duration(to: 1).Count()); Assert.Equal(2, medias.Duration(to: 3).Count()); }