public static void ShouldBePageable( SpIssueApi api ) { var firstRequest = api.GetLicenseList( "$skip=0&$top=1" ); var secondRequest = api.GetLicenseList( "$skip=1&$top=1" ); var first = VerifyResponse( firstRequest ).Single(); var second = VerifyResponse( secondRequest ).Single(); // Comparing objects for equality is best done by comparing the always-present self links Assert.NotNull( first ); Assert.NotNull( second ); Assert.NotEqual( first._links.self.href, second._links.self.href ); }
public static void ShouldAllowCounting( SpIssueApi api ) { var apiResult = api.GetLicenseList( "$inlinecount=allpages&$top=1" ); VerifyResponse( apiResult, shouldHaveCount: true ); Assert.True( apiResult.Data.__count > 1 ); Assert.Equal( 1, apiResult.Data.results.Count ); }
public static void ShouldHaveAtLeastOneItem( SpIssueApi api ) { var apiResult = api.GetLicenseList(); Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode ); Assert.NotNull( apiResult.Data ); var licenseData = apiResult.Data.results; Assert.NotEmpty( licenseData ); }
public static void ShouldYieldData( SpIssueApi api ) { var apiResult = api.GetLicenseList(); // It should always be possible to get the list Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode ); // If the request is OK, there should always be some Data Assert.NotNull( apiResult.Data ); // An empty list is always represented as an empty collection, not null var licenseData = apiResult.Data.results; Assert.NotNull( licenseData ); }
public static void ShouldBeSortable( SpIssueApi api ) { var apiResult = api.GetLicenseList( "$orderby=IssueDate desc" ); var licenseData = VerifyResponse( apiResult ); var resorted = licenseData.OrderByDescending( x => x.IssueDate ).ToArray(); Assert.True( resorted.SequenceEqual( licenseData ) ); }
public RandomLicenseFromListFixture( SpIssueApi api ) { var apiResult = api.GetLicenseList(); Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode ); var results = apiResult.Data.results; Assert.True( results.Any(), GetType().Name + " requires the target login to have at least one License" ); _randomItem = results.ElementAtRandom(); }
public static void GetListShouldRejectQueriesWithSelect( SpIssueApi api ) { var apiResult = api.GetLicenseList( "$select=ActivationKey" ); Assert.Equal( HttpStatusCode.BadRequest, apiResult.StatusCode ); Assert.Equal( "Unsupported Parameter: $select", apiResult.StatusDescription ); }