コード例 #1
0
        public void PagedListAsync_WhenSpecificationIsNull_ThrowsArgumentNullException()
        {
            var contextRepo = new ContextRepository <IAuditedContext>(It.IsAny <IAuditedContext>(), It.IsAny <ILogger <IAuditedContext> >());
            var exception   = Assert.ThrowsAsync <ArgumentNullException>(() => contextRepo.PagedListAsync <object>(0, 0, null));

            Assert.AreEqual("Value cannot be null. (Parameter 'specification')", exception.Message);
        }
コード例 #2
0
        public void PagedListAsync_WhenPageSizeIsLessThanOrEqualToZero_ThrowsArgumentException(int pageSize)
        {
            var mockSpecification = new Mock <LinqSpecification <object> >();
            var contextRepo       = new ContextRepository <IAuditedContext>(It.IsAny <IAuditedContext>(), It.IsAny <ILogger <IAuditedContext> >());
            var exception         = Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => contextRepo.PagedListAsync(0, pageSize, mockSpecification.Object));

            Assert.AreEqual("Specified argument was out of the range of valid values. (Parameter 'pageSize')", exception.Message);
        }