public void SortParameter001()
        {
            // Arrange
            var container         = new List <string>();
            var expressionCache   = new ExpressionCache <TestDocument>();
            var expressionBuilder = (IExpressionBuilder <TestDocument>) new ExpressionBuilder <TestDocument>(expressionCache);
            var parameter         = new SortParameter <TestDocument>(expressionBuilder);

            parameter.Configure(q => q.Id, true);

            // Act
            parameter.Execute(container);

            // Assert
            Assert.Equal(1, container.Count);
            Assert.Equal("sort=_id_ asc", container[0]);
        }
Exemplo n.º 2
0
        public void SortParameter001()
        {
            // Arrange
            var    expected = JObject.Parse(@"
            {
              ""sort"": ""_id_ asc""
            }");
            string actual;
            var    jObject           = new JObject();
            var    expressionCache   = new ExpressionCache <TestDocument>();
            var    expressionBuilder = (IExpressionBuilder <TestDocument>) new ExpressionBuilder <TestDocument>(expressionCache);
            var    parameter         = new SortParameter <TestDocument>(expressionBuilder);

            parameter.Configure(q => q.Id, true);

            // Act
            parameter.Execute(jObject);
            actual = jObject.ToString();

            // Assert
            Assert.Equal(expected.ToString(), actual);
        }