public static void CheckWithAdditionalRequestHeader(string additionalHeaderName, bool isAllowed) { RequestHeader additionalRequestHeader = new RequestHeader(additionalHeaderName, Guid.NewGuid().ToString()); MetaDataProviderBuilder builder = new MetaDataProviderBuilder("Ingenico"); if (isAllowed) { MetaDataProvider metaDataProvider = builder.WithAdditionalRequestHeader(additionalRequestHeader).Build(); IEnumerable <RequestHeader> requestHeaders = metaDataProvider.ServerMetaDataHeaders; Assert.AreEqual(2, requestHeaders.Count()); RequestHeader requestHeader = requestHeaders.First(); Assert.AreEqual("X-GCS-ServerMetaInfo", requestHeader.Name); requestHeader = requestHeaders.Skip(1).First(); Assert.AreEqual(requestHeader, additionalRequestHeader); } else { Assert.That((() => builder.WithAdditionalRequestHeader(additionalRequestHeader)), Throws.ArgumentException.With.Message.Contains(additionalHeaderName)); } }
public MetaDataProvider(MetaDataProviderBuilder builder) : this(builder.Integrator, builder.ShoppingCartExtension, builder.AdditionalRequestHeaders) { }