Skip to content

Commit 9ed43f0

Browse files
committed
fix(csharp): wait for api key test is generated
1 parent 86da476 commit 9ed43f0

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

tests/output/csharp/src/ClientExtensionsTests.cs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -79,57 +79,6 @@ public async Task ShouldWaitForTask()
7979
);
8080
}
8181

82-
[Fact]
83-
public async Task ShouldWaitForApiKey()
84-
{
85-
var httpMock = new Mock<IHttpRequester>();
86-
var client = new SearchClient(new SearchConfig("test-app-id", "test-api-key"), httpMock.Object);
87-
88-
httpMock
89-
.SetupSequence(c =>
90-
c.SendRequestAsync(
91-
It.Is<Request>(r => r.Uri.AbsolutePath.EndsWith("/1/keys/my-key")),
92-
It.IsAny<TimeSpan>(),
93-
It.IsAny<TimeSpan>(),
94-
It.IsAny<CancellationToken>()
95-
)
96-
)
97-
// First call throw an exception
98-
.Throws(new AlgoliaApiException("Oupss", 0))
99-
// Next call return a 404
100-
.Returns(Task.FromResult(new AlgoliaHttpResponse { HttpStatusCode = 404 }))
101-
// Third call return a Http 200
102-
.Returns(
103-
Task.FromResult(
104-
new AlgoliaHttpResponse
105-
{
106-
HttpStatusCode = 200,
107-
Body = new MemoryStream(
108-
Encoding.UTF8.GetBytes(
109-
serializer.Serialize(
110-
new GetApiKeyResponse() { CreatedAt = 12, Acl = new List<Acl>() }
111-
)
112-
)
113-
)
114-
}
115-
)
116-
);
117-
118-
await client.WaitForApiKeyAsync("my-key", ApiKeyOperation.Add);
119-
120-
// Verify that the request has been called three times
121-
httpMock.Verify(
122-
m =>
123-
m.SendRequestAsync(
124-
It.Is<Request>(r => r.Uri.AbsolutePath.EndsWith("/1/keys/my-key")),
125-
It.IsAny<TimeSpan>(),
126-
It.IsAny<TimeSpan>(),
127-
It.IsAny<CancellationToken>()
128-
),
129-
Times.Exactly(3)
130-
);
131-
}
132-
13382
[Fact]
13483
public async Task ShouldBrowseObjects()
13584
{

0 commit comments

Comments
 (0)