Esempio n. 1
0
			static string PutPendingCreate( SpCustomerApi api, string anonymousCustomerName, string anonymousCustomerExternalId, Guid anonymousRequestId )
			{
				var response = api.CreateCustomer( new SpCustomerApi.CustomerSummary() { Name = anonymousCustomerName, ExternalId = anonymousCustomerExternalId, RequestId = anonymousRequestId } );
				Assert.Equal( HttpStatusCode.Accepted, response.StatusCode );
				var createdAtLocation = Assert.IsType<string>( response.Headers.Single( x => x.Name == "Location" ).Value );
				return createdAtLocation;
			}
Esempio n. 2
0
		public static void ShouldYieldAcceptedWithALocationHref( SpCustomerApi api, string anonymousCustomerName, string anonymousCustomerExternalId, Guid anonymousRequestId )
		{
			var response = api.CreateCustomer( new SpCustomerApi.CustomerSummary() { Name = anonymousCustomerName, ExternalId = anonymousCustomerExternalId, RequestId = anonymousRequestId } );
			
			Assert.Equal( HttpStatusCode.Accepted, response.StatusCode );
			string result = Assert.IsType<string>( response.Headers.Single( x => x.Name == "Location" ).Value );

			Assert.NotEmpty( result );
		}
		public FreshCustomerFixture( SpCustomerApi api, string customerName, string customerExternalId, Guid requestId )
		{
			var response = api.CreateCustomer(  new SpCustomerApi.CustomerSummary { Name = customerName, ExternalId = customerExternalId, RequestId = requestId } );

			Assert.Equal( HttpStatusCode.Accepted, response.StatusCode );
			string location = Assert.IsType<string>( response.Headers.Single( x => x.Name == "Location" ).Value );

			var signedCustomer = GetCustomer( api, location );
			SignedCustomer = signedCustomer.Data;
		}
Esempio n. 4
0
				public static void PutExcessivelyLongShouldReject( SpCustomerApi api, string anonymousName )
				{
					var response = api.CreateCustomer( new SpCustomerApi.CustomerSummary() { Name = anonymousName, ExternalId = new String( 'a', 101 ) } );
					Assert.Equal( HttpStatusCode.BadRequest, response.StatusCode );
				}
Esempio n. 5
0
				public static void PutEmptyShouldReject( SpCustomerApi api, string anonymousExternalId )
				{
					var response = api.CreateCustomer( new SpCustomerApi.CustomerSummary() { Name = string.Empty, ExternalId = anonymousExternalId } );
					Assert.Equal( HttpStatusCode.BadRequest, response.StatusCode );
				}