Esempio n. 1
0
        public void Paged_To_ArgumentNullException()
        {
            // Arrange
            var items    = new[] { new User(Guid.NewGuid(), "one", "one"), new User(Guid.NewGuid(), "two", "two") };
            var page     = 2;
            var quantity = 4;
            var total    = 6;
            var paged    = new Paged <User>(items, page, quantity, total);

            // Act
            // Assert
            Assert.Throws <ArgumentNullException>(() => paged.To((Func <IEnumerable <User>, IEnumerable <object> >)null));
        }
Esempio n. 2
0
        public void Paged_To_ArgumentNullException()
        {
            // Arrange
            var items    = new[] { EntityHelper.CreateUser("one"), EntityHelper.CreateUser("two") };
            var page     = 2;
            var quantity = 4;
            var total    = 6;
            var paged    = new Paged <PimsUser>(items, page, quantity, total);

            // Act
            // Assert
            Assert.Throws <ArgumentNullException>(() => paged.To((Func <IEnumerable <PimsUser>, IEnumerable <object> >)null));
        }
Esempio n. 3
0
        public void Paged_To()
        {
            // Arrange
            var items    = new[] { new User(Guid.NewGuid(), "one", "one"), new User(Guid.NewGuid(), "two", "two") };
            var page     = 2;
            var quantity = 4;
            var total    = 6;
            var paged    = new Paged <User>(items, page, quantity, total);

            // Act
            var result = paged.To((items) => items.Select(i => new { Key = $"{i.Id}" }));

            // Assert
            result.Page.Should().Be(page);
            result.Quantity.Should().Be(quantity);
            result.Total.Should().Be(total);
            result.Items.Count().Should().Be(items.Length);
            result.Items.First().Key.Should().Be(items.First().Id.ToString());
        }