public void downloads_enumerable() { Assert.Throws<ArgumentNullException>(() => ((IEnumerable<Download>)null).Downloads()); var downloads = new[] { null, new Download(), new Download { Downloads = 1 }, new Download { Downloads = 2 } }; Assert.Equal(3, downloads.Downloads().Count()); Assert.Equal(2, downloads.Downloads(0).Count()); Assert.Empty(downloads.Downloads(3)); Assert.Equal(1, downloads.Downloads(0, 1).Count()); Assert.Equal(2, downloads.Downloads(1, 2).Count()); Assert.Empty(downloads.Downloads(to: 0)); Assert.Equal(1, downloads.Downloads(to: 1).Count()); Assert.Equal(2, downloads.Downloads(to: 3).Count()); }
public void priority_queryable() { Assert.Throws<ArgumentNullException>(() => ((IQueryable<Download>)null).Downloads()); var downloads = new[] { new Download { Downloads = 1 }, new Download { Downloads = 2 } }.AsQueryable(); Assert.Equal(2, downloads.Downloads().Count()); Assert.Equal(2, downloads.Downloads(0).Count()); Assert.Empty(downloads.Downloads(3)); Assert.Equal(1, downloads.Downloads(0, 1).Count()); Assert.Equal(2, downloads.Downloads(1, 2).Count()); Assert.Empty(downloads.Downloads(to: 0)); Assert.Equal(1, downloads.Downloads(to: 1).Count()); Assert.Equal(2, downloads.Downloads(to: 3).Count()); }