Beispiel #1
0
 /// <summary>
 /// Creates a new SearchTestBase instance.
 /// </summary>
 /// <param name="async">
 /// When false, we'll rewrite our tests methods to call the sync
 /// versions of async APIs.
 /// </param>
 /// <param name="serviceVersion">
 /// Version of the REST API to test against.
 /// </param>
 /// <param name="mode">
 /// Whether to run in Playback, Record, or Live mode.  The default
 /// value is pulled from the AZURE_TEST_MODE environment variable.
 /// </param>
 public SearchTestBase(bool async, SearchClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null)
     : base(async, mode ?? RecordedTestUtilities.GetModeFromEnvironment())
 {
     ServiceVersion = serviceVersion;
     Sanitizer      = new SearchRecordedTestSanitizer();
     Matcher        = new RecordMatcher(compareBodies: false);
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the SearchIndexClient class from a
        /// <see cref="SearchServiceClient"/>.
        /// </summary>
        /// <param name="endpoint">
        /// Required.  The URI endpoint of the Search Service.  This is likely
        /// to be similar to "https://{search_service}.search.windows.net".
        /// The URI must use HTTPS.
        /// </param>
        /// <param name="indexName">
        /// Required.  The name of the Search Index.
        /// </param>
        /// <param name="pipeline">
        /// The authenticated <see cref="HttpPipeline"/> used for sending
        /// requests to the Search Service.
        /// </param>
        /// <param name="diagnostics">
        /// The <see cref="Azure.Core.Pipeline.ClientDiagnostics"/> used to
        /// provide tracing support for the client library.
        /// </param>
        /// <param name="version">
        /// The REST API version of the Search Service to use when making
        /// requests.
        /// </param>
        internal SearchIndexClient(
            Uri endpoint,
            string indexName,
            HttpPipeline pipeline,
            ClientDiagnostics diagnostics,
            SearchClientOptions.ServiceVersion version)
        {
            Debug.Assert(endpoint != null);
            Debug.Assert(string.Equals(endpoint.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase));
            Debug.Assert(!string.IsNullOrEmpty(indexName));
            Debug.Assert(pipeline != null);
            Debug.Assert(diagnostics != null);
            Debug.Assert(SearchClientOptions.ServiceVersion.V2019_05_06 <= version &&
                         version <= SearchClientOptions.LatestVersion);

            Endpoint          = endpoint;
            IndexName         = indexName;
            ClientDiagnostics = diagnostics;
            Pipeline          = pipeline;
            Version           = version;

            Operations = new DocumentsClient(
                ClientDiagnostics,
                Pipeline,
                endpoint.ToString(),
                IndexName,
                Version.ToVersionString());
        }
Beispiel #3
0
 /// <summary>
 /// Creates a new SearchTestBase instance.
 /// </summary>
 /// <param name="async">
 /// When false, we'll rewrite our tests methods to call the sync
 /// versions of async APIs.
 /// </param>
 /// <param name="serviceVersion">
 /// Version of the REST API to test against.
 /// </param>
 /// <param name="mode">
 /// Whether to run in Playback, Record, or Live mode.  The default
 /// value is pulled from the AZURE_TEST_MODE environment variable.
 /// </param>
 public SearchTestBase(bool async, SearchClientOptions.ServiceVersion serviceVersion, RecordedTestMode?mode = null)
     : base(async, mode)
 {
     ServiceVersion = serviceVersion;
     JsonPathSanitizers.Add("$..applicationSecret");
     SanitizedHeaders.Add("api-key");
     CompareBodies = false;
 }
 public HelloWorld(bool async, SearchClientOptions.ServiceVersion serviceVersion)
     : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */)
 {
 }
Beispiel #5
0
 public IndexingDocuments(bool async, SearchClientOptions.ServiceVersion serviceVersion)
     : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */)
 {
 }
Beispiel #6
0
 /// <summary>
 /// Validate a <see cref="SearchClientOptions.ServiceVersion"/>.
 /// </summary>
 /// <param name="version">
 /// The <see cref="SearchClientOptions.ServiceVersion"/> to validate.
 /// </param>
 /// <returns>
 /// The validated version.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">
 /// Thrown when the <paramref name="version"/> is not supported by this
 /// client library.
 /// </exception>
 public static SearchClientOptions.ServiceVersion Validate(this SearchClientOptions.ServiceVersion version) =>
 version switch
 {
Beispiel #7
0
 public EncryptedIndex(bool async, SearchClientOptions.ServiceVersion serviceVersion)
     : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */)
 {
 }
 public FieldBuilderIgnore(bool async, SearchClientOptions.ServiceVersion serviceVersion)
     : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */)
 {
 }
Beispiel #9
0
 public AutocompleteTests(bool async, SearchClientOptions.ServiceVersion serviceVersion)
     : base(async, serviceVersion, null /* RecordedTestMode.Record /* to re-record */)
 {
 }