public static void ShouldShowInAssignedLicenseListing( bool expandCustomer, [Frozen] SpIssueApi api, RandomLicenseFromListFixture license, GetRandomCustomerFixture customer ) { var licenseCustomerAssignmentHref = license.Selected._links.customerAssignment.href; var apiResult = api.PutLicenseCustomerAssignment( licenseCustomerAssignmentHref, customer.DataFromGet ); Assert.Equal( HttpStatusCode.Accepted, apiResult.StatusCode ); Verify.EventuallyWithBackOff( () => { var query = "$filter=not (Customer eq null)"; if ( expandCustomer ) query += "&$expand=Customer"; var unassignedLicenses = api.GetLicenseList( query ); var licenseData = VerifyResponse( unassignedLicenses ); // The assigned license should now appear in the assigned list Assert.Single( licenseData.Where( x => x._links.self.href == license.Selected._links.self.href ) ); // All licenses within this filtered set should show a customer link Assert.True( licenseData.All( x => x._links.customer.href != null ) ); // All licenses within this filtered set should have had their Customer data expanded Assert.Equal( expandCustomer, licenseData.All( x => x._embedded.Customer != null ) ); } ); }
public static void ShouldResetCustomerLink( [Frozen] SpIssueApi api, RandomLicenseFromListFixture license, GetRandomCustomerFixture customer ) { //Assign a customer first // (This is not strictly necessary, we just want to observe a real user actually seeing the change take place in the License list itself Put.ShouldUpdateCustomerLink( api, license, customer ); // Unassign the customer var licenseCustomerAssignmentHref = license.Selected._links.customerAssignment.href; var apiResult = api.DeleteLicenseCustomerAssignment( licenseCustomerAssignmentHref ); Assert.Contains( apiResult.StatusCode, new[] { HttpStatusCode.NoContent, HttpStatusCode.NotFound } ); // TODO assert order in xUnit.net should be reversed Verify.EventuallyWithBackOff( () => { var updated = api.GetLicense( license.Selected._links.self.href ); Assert.Equal( HttpStatusCode.OK, updated.StatusCode ); Assert.Null( updated.Data._links.customer ); } ); }
public static void ShouldUpdateCustomerLink( [Frozen] SpIssueApi api, RandomLicenseFromListFixture license, GetRandomCustomerFixture customer ) { var licenseData = license.Selected; var signedCustomerData = customer.DataFromGet; UpdateAndVerifyCustomerLink( api, licenseData, signedCustomerData ); }