Пример #1
0
        public void Search_NullSearchProperty_Throws()
        {
            var request = CreateRequest();

            request.Text = null;

            var search = new GenericSearch(CreateProvider(), null);

            search.Invoking(x => x.Search(Query, request))
            .Should()
            .ThrowExactly <NullReferenceException>();
        }
Пример #2
0
        public void Paginate_NoRows_Throws()
        {
            var request = CreateRequest();

            request.Page = 1;
            var provider = CreateProvider(x => x.RowsDefinition = new RowsExpression <Request, Result>("Something"));

            var search = new GenericSearch(provider, null);

            search.Invoking(x => x.Paginate(Query, request))
            .Should()
            .ThrowExactly <NullReferenceException>();
        }
Пример #3
0
        public void Missing_Configuration_Throws()
        {
            var configurationProvider = new Mock <IListConfigurationProvider>();

            configurationProvider.Setup(x => x.GetConfiguration(It.IsAny <Type>())).Returns((ListConfiguration)null);

            var request = CreateRequest();

            var search = new GenericSearch(configurationProvider.Object, null);

            search.Invoking(x => x.Search(Query, request))
            .Should()
            .ThrowExactly <MissingConfigurationException>();
        }
Пример #4
0
        public void Paginate_ZeroRows_Throws()
        {
            var request = CreateRequest();

            request.Page = 1;

            var provider = CreateProvider();

            var search = new GenericSearch(provider, null);

            search.Invoking(x => x.Paginate(Query, request))
            .Should()
            .ThrowExactly <ArgumentOutOfRangeException>();
        }