public async Task DeleteAqlFunctionAsync_ShouldSucceed() { string groupName = System.Environment.TickCount.ToString(); string fullName = string.Join( "::", groupName, nameof(DeleteAqlFunctionAsync_ShouldSucceed)); PostAqlFunctionResponse postResponse = await _fixture.AqlFunctionClient.PostAqlFunctionAsync( new PostAqlFunctionBody() { Name = fullName, Code = "function (celsius) { return celsius * 1.8 + 32; }", IsDeterministic = true }); DeleteAqlFunctionResponse deleteResponse = await _fixture.AqlFunctionClient.DeleteAqlFunctionAsync( groupName, new DeleteAqlFunctionQuery() { Group = true }); Assert.False(deleteResponse.ResponseDetails.Error); Assert.Equal(HttpStatusCode.OK, deleteResponse.ResponseDetails.Code); Assert.Equal(1, deleteResponse.DeletedCount); }
public async Task GetAqlFunctionsAsync_ShouldSucceed() { string groupName = System.Environment.TickCount.ToString(); string fullName = string.Join( "::", groupName, nameof(DeleteAqlFunctionAsync_ShouldSucceed)); PostAqlFunctionResponse postResponse = await _fixture.AqlFunctionClient.PostAqlFunctionAsync( new PostAqlFunctionBody() { Name = fullName, Code = "function (celsius) { return celsius * 1.8 + 32; }", IsDeterministic = true }); GetAqlFunctionsResponse getResponse = await _fixture.AqlFunctionClient.GetAqlFunctionsAsync( new GetAqlFunctionsQuery() { Namespace = groupName }); Assert.False(getResponse.ResponseDetails.Error); Assert.Equal(HttpStatusCode.OK, getResponse.ResponseDetails.Code); Assert.Single(getResponse); AqlFunctionResult firstResult = getResponse[0]; Assert.Equal(fullName, firstResult.Name); Assert.Equal("function (celsius) { return celsius * 1.8 + 32; }", firstResult.Code); Assert.True(firstResult.IsDeterministic); }
public async Task PostAqlFunctionAsync_ShouldReturnError_WhenFunctionNameIsInvalid() { PostAqlFunctionResponse postAqlFunctionResponse = await _fixture.AqlFunctionClient.PostAqlFunctionAsync( new PostAqlFunctionBody() { // A non-fully qualified name will give an error Name = nameof(PostAqlFunctionAsync_ShouldSucceed), Code = "function (celsius) { return celsius * 1.8 + 32; }", IsDeterministic = true }); Assert.False(postAqlFunctionResponse.IsSuccess); Assert.Equal(HttpStatusCode.BadRequest, postAqlFunctionResponse.ResponseDetails.Code); Assert.Equal(1580, postAqlFunctionResponse.ResponseDetails.ErrorNum); // ERROR_QUERY_FUNCTION_INVALID_NAME }
public async Task PostAqlFunctionAsync_ShouldSucceed() { string fullName = string.Join( "::", System.Environment.TickCount.ToString(), nameof(PostAqlFunctionAsync_ShouldSucceed)); PostAqlFunctionResponse response = await _fixture.AqlFunctionClient.PostAqlFunctionAsync( new PostAqlFunctionBody { Name = fullName, Code = "function (celsius) { return celsius * 1.8 + 32; }", IsDeterministic = true }); Assert.False(response.ResponseDetails.Error); Assert.Equal(HttpStatusCode.Created, response.ResponseDetails.Code); Assert.True(response.IsNewlyCreated); }