コード例 #1
0
        public StorageTestBase(bool async, RecordedTestMode?mode = null)
            : base(async, mode)
        {
            SanitizedQueryParameters.Add(SignatureQueryName);

#if NETFRAMEWORK
            // Uri uses different escaping for some special characters between .NET Framework and Core. Because the Test Proxy runs on .NET
            // Core, we need to normalize to the .NET Core escaping when matching and storing the recordings when running tests on NetFramework.
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\(", "%28"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\)", "%29"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\!", "%21"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\'", "%27"));
            UriRegexSanitizers.Add(new UriRegexSanitizer("\\*", "%2A"));
            // Encode any colons in the Uri except for the one in the scheme
            UriRegexSanitizers.Add(new UriRegexSanitizer("(?<group>:)[^//]", "%3A")
            {
                GroupForReplace = "group"
            });
#endif

            HeaderRegexSanitizers.Add(new HeaderRegexSanitizer("x-ms-encryption-key", SanitizeValue));
            HeaderRegexSanitizers.Add(new HeaderRegexSanitizer(CopySourceAuthorization, SanitizeValue));

            SanitizedQueryParametersInHeaders.Add((CopySourceName, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((RenameSource, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((PreviousSnapshotUrl, SignatureQueryName));
            SanitizedQueryParametersInHeaders.Add((FileRenameSource, SignatureQueryName));

            BodyRegexSanitizers.Add(new BodyRegexSanitizer(@"client_secret=(?<group>.*?)(?=&|$)", SanitizeValue)
            {
                GroupForReplace = "group"
            });

            Tenants = new TenantConfigurationBuilder(this);
        }
コード例 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="tenantConfigurationBuilder">Source of tenants for appropriate service clients.</param>
 /// <param name="getServiceClient">Constructs a service client from the given arguments.</param>
 /// <param name="getServiceClientStorageSharedKeyCredential">Constructs a service client from the given arguments.</param>
 /// <param name="getServiceClientTokenCredential">Constructs a service client from the given arguments.</param>
 /// <param name="getServiceClientAzureSasCredential">Constructs a service client from the given arguments.</param
 /// <param name="getServiceClientOptions">Constructs service-specific client options.</param>
 public ClientBuilder(
     ServiceEndpoint serviceEndpoint,
     TenantConfigurationBuilder tenantConfigurationBuilder,
     GetServiceClient getServiceClient,
     GetServiceClientStorageSharedKeyCredential getServiceClientStorageSharedKeyCredential,
     GetServiceClientTokenCredential getServiceClientTokenCredential,
     GetServiceClientAzureSasCredential getServiceClientAzureSasCredential,
     GetServiceClientOptions getServiceClientOptions)
 {
     _serviceEndpoint  = serviceEndpoint;
     Tenants           = tenantConfigurationBuilder;
     _getServiceClient = getServiceClient;
     _getServiceClientStorageSharedKeyCredential = getServiceClientStorageSharedKeyCredential;
     _getServiceClientTokenCredential            = getServiceClientTokenCredential;
     _getServiceClientAzureSasCredential         = getServiceClientAzureSasCredential;
     _getServiceClientOptions = getServiceClientOptions;
 }
コード例 #3
0
 public StorageTestBase(bool async, RecordedTestMode?mode = null)
     : base(async, mode, useLegacyTransport: true)
 {
     Sanitizer = new StorageRecordedTestSanitizer();
     Tenants   = new TenantConfigurationBuilder(this);
 }