Пример #1
0
            public static void ShouldAllowCounting( SpPortalActivationApi api )
            {
                var apiResult = api.GetActivations( "$inlinecount=allpages&$top=1" );

                VerifyResponse( apiResult, shouldHaveCount: true );
                Assert.True( apiResult.Data.__count > 1 );
                Assert.Equal( 1, apiResult.Data.results.Count );
            }
Пример #2
0
            public static void ShouldAllowOrdering( SpPortalActivationApi api )
            {
                var apiResult = api.GetActivations( "$orderby=ActivationTime desc" );

                var data = VerifyResponse( apiResult );

                Assert.NotEmpty( data );
                var ordered = data.OrderByDescending( x => x.ActivationTime ).ToArray();

                Assert.Equal( ordered.AsEnumerable(), data.AsEnumerable() );
            }
Пример #3
0
            public static void ShouldAllowPaging( SpPortalActivationApi api )
            {
                var firstQuery = api.GetActivations( "$skip=0&$top=1" );
                var secondQuery = api.GetActivations( "$skip=1&$top=1" );

                SpPortalActivationApi.Activation first = VerifyResponse( firstQuery ).Single();
                SpPortalActivationApi.Activation second = VerifyResponse( secondQuery ).Single();

                Assert.NotNull( first );
                Assert.NotNull( second );
                Assert.NotEqual( first._links.self.href, second._links.self.href );
            }
Пример #4
0
            public static void ShouldRespondToUnsupportedQueriesWithBadRequestAndStatusDescription( SpPortalActivationApi api )
            {
                var expectedFailures = new Dictionary<string, string>()
                {
                    {"$top=1001","The field Top must be between 1 and 1000."},
                    {"$top=NaN","The field Top must be between 1 and 1000."},
                    {"$top=","The Top field is required."},         // a specified query field must be provided
				    {"$orderby=","The OrderBy field is required."}  // a specified query field must be provided
				};

                foreach ( var expectedFailure in expectedFailures )
                {
                    var invalidQueryResult = api.GetActivations( expectedFailure.Key );
                    Assert.Equal( HttpStatusCode.BadRequest, invalidQueryResult.StatusCode );
                    Assert.Equal( expectedFailure.Value, invalidQueryResult.StatusDescription );
                }
            }
Пример #5
0
 public static void ShouldYieldResults( SpPortalActivationApi api )
 {
     var apiResult = api.GetActivations();
     VerifyResponse( apiResult );
 }