Slide 16
Slide 16 text
16
© Sansan, Inc.
コード例: 単体テスト
「拠点情報⼀覧取得」単体テスト⽤モック
var response = new GetBusinessLocationsByOrganizationId_Organization_Organization(“organization_id”,
new GetBusinessLocationsBySoc_Organization_BusinessLocations_BusinessLocationConnection(
new List
{
new GetBusinessLocationsBySoc_Organization_BusinessLocations_Edges_BusinessLocationEdge(
new
GetBusinessLocationsByOrganizationId_Organization_BusinessLocations_Edges_Node_BusinessLocation(“organization
_id”, "business_location_id", "business_location_name", “test_address”))),
}));
var mockApiClient = new Mock();
var mockResponse = new Mock>();
mockResponse.Setup(x => x.Errors).Returns(Array.Empty());
mockResponse.Setup(x => x.Data).Returns(
new GetBusinessLocationsBySocResult(response));
mockApiClient
.Setup(x => x.GetBusinessLocationsByOrganizationId.ExecuteAsync(“organization_id”, It.IsAny()))
.ReturnsAsync(mockResponse.Object);