public GetRandomCustomerFixture( SpCustomerApi api, RandomCustomerFromListFixture list )
		{
			//Now query the API for that specific customer by following the self link from the item in the Index obtained in the previous step
			var linkedAddress = list.Selected._links.self;
			var apiResult = api.GetCustomer( linkedAddress.href );
			Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode );
			DataFromGet = apiResult.Data;
		}
		static IRestResponse<SpCustomerApi.CustomerSummary> GetCustomer( SpCustomerApi api, string location )
		{
			var apiResult = default(IRestResponse<SpCustomerApi.CustomerSummary>);
			Verify.EventuallyWithBackOff( () =>
			{
				apiResult = api.GetCustomer( location );
				Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode );
			} );
			return apiResult;
		}
예제 #3
0
			public static void ShouldEventuallyBeGettable( SpCustomerApi api, string anonymousCustomerName, string anonymousCustomerExternalId, Guid anonymousRequestId )
			{
				string createdAtLocation = PutPendingCreate( api, anonymousCustomerName, anonymousCustomerExternalId, anonymousRequestId );

				Verify.EventuallyWithBackOff( () =>
				{
					var apiResult = api.GetCustomer( createdAtLocation );
					Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode );
					var resultData = apiResult.Data;
				} );
			}
예제 #4
0
		/// <summary>
		/// In the course of our testing, we need to be assured the changes actually get applied.
		/// In the standard programming model, it is safe to assume success once one has attained an HttpStatusCode.Accept on the PUT - in the rare case of conflicts, this will be detected and handled in the normal way.
		/// For the purposes of the test, we are actually prepared to hang around to double-check that they really do get applied.
		/// </summary>
		static void VerifyGetCustomerReflectsAcceptedChanges( SpCustomerApi api, SpCustomerApi.CustomerSummary customerData )
		{
			Verify.EventuallyWithBackOff( () =>
			{
				var apiResult = api.GetCustomer( customerData._links.self.href );
				Assert.Equal( HttpStatusCode.OK, apiResult.StatusCode );

				apiResult.Data.AsSource().OfLikeness<SpCustomerApi.CustomerSummary>()
					.OmitAutoComparison()
					.WithDefaultEquality( x => x.ExternalId )
					.WithDefaultEquality( x => x.Name )
					.ShouldEqual( customerData );
			} );
		}
예제 #5
0
				public static void ShouldUpdateCustomerLinkForWellKnownTestCustomer( [Frozen] SpIssueApi api, RandomLicenseFromListFixture license, SpCustomerApi customerApi )
				{
					var licenseData = license.Selected;
					var customerData = customerApi.GetCustomerList( "$filter=Name eq Test" ).Data.results.Single();
					var signedCustomerData = customerApi.GetCustomer( customerData._links.self.href ).Data;
					UpdateAndVerifyCustomerLink( api, licenseData, signedCustomerData );
				}