示例#1
0
			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 );
			}
示例#2
0
			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 );
			}
示例#3
0
			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 );
			}
示例#4
0
			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 );
			}
示例#5
0
			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 ) );
			}
示例#6
0
			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();
			}
示例#7
0
			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 );
			}