コード例 #1
0
        public void Execute_WithPagingOptionsAndManualPagingOptions_ThrowsInvalidOperationException()
        {
            //prepare
            _options.Setup(o => o.PagingOptions)
            .Returns(new PagingOptions(1, null));
            _options.Setup(o => o.Controls)
            .Returns(new[] { new PageResultRequestControl() });
            var command = new MockStandardQueryCommand(_options.Object, _mapping.Object)
                          .DisablePagedRequest()
                          .DisableStandardRequest();

            //assert
            Executing.This(() => command.Execute(null, SearchScope.OneLevel, 1, true))
            .Should().Throw <InvalidOperationException>()
            .Exception.Message.Should().Be.EqualTo("Only one page request control can be sent to the server.");
        }
コード例 #2
0
        public void Execute_WithSortOptionsAndManualSortOptions_ThrowsInvalidOperationException()
        {
            //prepare
            var sort = new SortingOptions();

            sort.AddSort("test", true);
            _options.Setup(o => o.SortingOptions)
            .Returns(sort);
            _options.Setup(o => o.Controls)
            .Returns(new[] { new SortRequestControl() });
            var command = new MockStandardQueryCommand(_options.Object, _mapping.Object)
                          .DisablePagedRequest()
                          .DisableStandardRequest();

            //assert
            Executing.This(() => command.Execute(null, SearchScope.OneLevel, 1, true))
            .Should().Throw <InvalidOperationException>()
            .And.Exception.Message.Should().Be.EqualTo("Only one sort request control can be sent to the server");
        }
コード例 #3
0
        public void Execute_WithSortOptionsAndNoPagingOptions_CallsHandleStandardRequest()
        {
            //prepare
            var sort = new SortingOptions();

            sort.AddSort("test", true);
            _options.Setup(o => o.SortingOptions)
            .Returns(sort);
            var command = new MockStandardQueryCommand(_options.Object, _mapping.Object)
                          .DisablePagedRequest()
                          .DisableStandardRequest();

            //act
            command.Execute(null, SearchScope.OneLevel, 1, true);

            //assert
            command.GetRequest().Controls.OfType <SortRequestControl>().Should().Have.Count.EqualTo(1);
            command.HandleStandardRequestCalled.Should().Be.True();
            command.HandlePagedRequestCalled.Should().Be.False();
        }