Exemplo n.º 1
0
        public void CanListQueryKeys()
        {
            Run(() =>
            {
                SearchManagementClient searchMgmt = GetSearchManagementClient();

                ListQueryKeysResult queryKeyResult =
                    searchMgmt.QueryKeys.List(Data.ResourceGroupName, Data.SearchServiceName);

                Assert.NotNull(queryKeyResult);
                Assert.Equal(1, queryKeyResult.Value.Count);
                Assert.Null(queryKeyResult.Value[0].Name);   // Default key has no name.
                Assert.NotNull(queryKeyResult.Value[0].Key);
                Assert.NotEmpty(queryKeyResult.Value[0].Key);
            });
        }
Exemplo n.º 2
0
        public override void Initialize(MockContext context)
        {
            base.Initialize(context);

            MockContext = context;

            SearchManagementClient client = context.GetServiceClient <SearchManagementClient>();

            SearchServiceName = EnsureSearchService(client);

            AdminKeyResult adminKeyResult = client.AdminKeys.List(ResourceGroupName, SearchServiceName);

            Assert.NotNull(adminKeyResult);

            PrimaryApiKey = adminKeyResult.PrimaryKey;

            ListQueryKeysResult queryKeyResult = client.QueryKeys.List(ResourceGroupName, SearchServiceName);

            Assert.NotNull(queryKeyResult);
            Assert.Equal(1, queryKeyResult.Value.Count);

            QueryApiKey = queryKeyResult.Value[0].Key;
        }