Home > Mobile >  Mocking TableClient DeleteEntityAsync - Azure.Response
Mocking TableClient DeleteEntityAsync - Azure.Response

Time:06-11

I need to mock the DeleteEntityAsync method of TableClient.
enter image description here

CodePudding user response:

I'm working on the same thing. Try this:

var mockResponse = new Mock<Response>();
mockResponse.SetupGet(x => x.Status).Returns((int)HttpStatusCode.NotFound);
mockResponse.SetupGet(x => x.Content).Returns(BinaryData.FromString("data source here"));

tableClient.Setup(x => x.DeleteEntityAsync(It.IsAny<string>(), It.IsAny<string>(), default, default)).ReturnsAsync(mockResponse.Object);
  • Related