public async Task BatchCreateOccurrencesAsync2() { Mock <Grafeas.GrafeasClient> mockGrpcClient = new Mock <Grafeas.GrafeasClient>(MockBehavior.Strict); BatchCreateOccurrencesRequest request = new BatchCreateOccurrencesRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), Occurrences = { }, }; BatchCreateOccurrencesResponse expectedResponse = new BatchCreateOccurrencesResponse(); mockGrpcClient.Setup(x => x.BatchCreateOccurrencesAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <BatchCreateOccurrencesResponse>(Task.FromResult(expectedResponse), null, null, null, null)); GrafeasClient client = new GrafeasClientImpl(mockGrpcClient.Object, null); BatchCreateOccurrencesResponse response = await client.BatchCreateOccurrencesAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void BatchCreateOccurrences2() { Mock <Grafeas.GrafeasClient> mockGrpcClient = new Mock <Grafeas.GrafeasClient>(MockBehavior.Strict); BatchCreateOccurrencesRequest request = new BatchCreateOccurrencesRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), Occurrences = { }, }; BatchCreateOccurrencesResponse expectedResponse = new BatchCreateOccurrencesResponse(); mockGrpcClient.Setup(x => x.BatchCreateOccurrences(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); GrafeasClient client = new GrafeasClientImpl(mockGrpcClient.Object, null); BatchCreateOccurrencesResponse response = client.BatchCreateOccurrences(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }