public async Task GetOccurrenceNoteAsync2() { Mock <Grafeas.GrafeasClient> mockGrpcClient = new Mock <Grafeas.GrafeasClient>(MockBehavior.Strict); GetOccurrenceNoteRequest request = new GetOccurrenceNoteRequest { OccurrenceName = new OccurrenceName("[PROJECT]", "[OCCURRENCE]"), }; Note expectedResponse = new Note { NoteName = new NoteName("[PROJECT]", "[NOTE]"), ShortDescription = "shortDescription-235369287", LongDescription = "longDescription-1747792199", }; mockGrpcClient.Setup(x => x.GetOccurrenceNoteAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Note>(Task.FromResult(expectedResponse), null, null, null, null)); GrafeasClient client = new GrafeasClientImpl(mockGrpcClient.Object, null); Note response = await client.GetOccurrenceNoteAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetOccurrenceNote() { Mock <Grafeas.GrafeasClient> mockGrpcClient = new Mock <Grafeas.GrafeasClient>(MockBehavior.Strict); GetOccurrenceNoteRequest expectedRequest = new GetOccurrenceNoteRequest { OccurrenceName = new OccurrenceName("[PROJECT]", "[OCCURRENCE]"), }; Note expectedResponse = new Note { NoteName = new NoteName("[PROJECT]", "[NOTE]"), ShortDescription = "shortDescription-235369287", LongDescription = "longDescription-1747792199", }; mockGrpcClient.Setup(x => x.GetOccurrenceNote(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); GrafeasClient client = new GrafeasClientImpl(mockGrpcClient.Object, null); OccurrenceName name = new OccurrenceName("[PROJECT]", "[OCCURRENCE]"); Note response = client.GetOccurrenceNote(name); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }