Skip to content

Commit

Permalink
Allow SearchIndex constructor to init null fields (Azure#15950)
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths authored and annelo-msft committed Feb 17, 2021
1 parent 6845e35 commit c4ece18
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 4 deletions.
3 changes: 3 additions & 0 deletions sdk/search/Azure.Search.Documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 11.2.0-beta.2 (Unreleased)

### Fixed

- Fixed issue calling `SearchIndexClient.GetIndexNames` that threw an exception ([#15590](https://github.com/Azure/azure-sdk-for-net/issues/15590))

## 11.2.0-beta.1 (2020-10-09)

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Azure.Search.Documents.Indexes.Models
{
public partial class SearchIndex
{
// Force the constructor to set the field;
// otherwise, when getting only names, the setter will throw.
[CodeGenMember("fields")]
private IList<SearchField> _fields;

[CodeGenMember("etag")]
Expand Down
16 changes: 16 additions & 0 deletions sdk/search/Azure.Search.Documents/tests/SearchIndexClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ public async Task GetIndexesNextPageThrows()
Assert.ThrowsAsync<NotSupportedException>(async () => await e.MoveNextAsync());
}

[Test]
public async Task GetIndexNames()
{
await using SearchResources resources = await SearchResources.GetSharedHotelsIndexAsync(this);

SearchIndexClient client = resources.GetIndexClient();

bool found = false;
await foreach (string name in client.GetIndexNamesAsync())
{
found |= string.Equals(resources.IndexName, name, StringComparison.InvariantCultureIgnoreCase);
}

Assert.IsTrue(found, "Shared index name not found");
}

[Test]
[SyncOnly]
public void DeleteIndexParameterValidation()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c4ece18

Please sign in to comment.