public void UpdateGroup() { moq::Mock <ErrorGroupService.ErrorGroupServiceClient> mockGrpcClient = new moq::Mock <ErrorGroupService.ErrorGroupServiceClient>(moq::MockBehavior.Strict); UpdateGroupRequest request = new UpdateGroupRequest { Group = new ErrorGroup(), }; ErrorGroup expectedResponse = new ErrorGroup { ErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"), GroupId = "group_id4f9a930e", TrackingIssues = { new TrackingIssue(), }, ResolutionStatus = ResolutionStatus.Muted, }; mockGrpcClient.Setup(x => x.UpdateGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ErrorGroupServiceClient client = new ErrorGroupServiceClientImpl(mockGrpcClient.Object, null); ErrorGroup response = client.UpdateGroup(request.Group); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateGroup2() { Mock <ErrorGroupService.ErrorGroupServiceClient> mockGrpcClient = new Mock <ErrorGroupService.ErrorGroupServiceClient>(MockBehavior.Strict); UpdateGroupRequest request = new UpdateGroupRequest { Group = new ErrorGroup(), }; ErrorGroup expectedResponse = new ErrorGroup { GroupName = new GroupName("[PROJECT]", "[GROUP]"), GroupId = "groupId506361563", }; mockGrpcClient.Setup(x => x.UpdateGroup(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ErrorGroupServiceClient client = new ErrorGroupServiceClientImpl(mockGrpcClient.Object, null); ErrorGroup response = client.UpdateGroup(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }