public void SourceTrackingHeaderGeneratedFromAttribute()
        {
            var attr = new DeliverySourceTrackingHeaderAttribute("CustomModule", 1, 2, 3);

            var value = HttpRequestHeadersExtensions.GenerateSourceTrackingHeaderValue(GetType().Assembly, attr);

            Assert.Equal("CustomModule;1.2.3", value);
        }
        public void SourceTrackingHeaderGeneratedFromAssembly()
        {
            var assembly        = GetType().Assembly;
            var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
            var sourceVersion   = fileVersionInfo.ProductVersion;
            var attr            = new DeliverySourceTrackingHeaderAttribute();

            var value = HttpRequestHeadersExtensions.GenerateSourceTrackingHeaderValue(assembly, attr);

            Assert.Equal($"Kentico.Kontent.Delivery.Tests;{sourceVersion}", value);
        }
        public void SourceGeneratedCorrectly()
        {
            var sourceAssembly        = HttpRequestHeadersExtensions.GetOriginatingAssembly();
            var sourceFileVersionInfo = FileVersionInfo.GetVersionInfo(sourceAssembly.Location);
            var sourceVersion         = sourceFileVersionInfo.ProductVersion;

            // Act
            var source = HttpRequestHeadersExtensions.GetSource();

            // Assert
            Assert.Equal($"Kentico.Kontent.Delivery.Tests;{sourceVersion}", source);
        }
Пример #4
0
 private string ApplyData(string data)
 {
     data = data.Replace(SDK_ID_REPLACEMENT, HttpRequestHeadersExtensions.GetSdkTrackingHeader());
     return(data.Replace(PROJECT_ID_REPLACEMENT, _options.ProjectId).Replace(API_KEY_REPLACEMENT, _options.ApiKey));
 }