public void Commit2() { moq::Mock <Datastore.DatastoreClient> mockGrpcClient = new moq::Mock <Datastore.DatastoreClient>(moq::MockBehavior.Strict); CommitRequest request = new CommitRequest { Mode = CommitRequest.Types.Mode.Unspecified, Mutations = { new Mutation(), }, ProjectId = "project_id43ad98b0", }; CommitResponse expectedResponse = new CommitResponse { MutationResults = { new MutationResult(), }, IndexUpdates = 1466771529, }; mockGrpcClient.Setup(x => x.Commit(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DatastoreClient client = new DatastoreClientImpl(mockGrpcClient.Object, null); CommitResponse response = client.Commit(request.ProjectId, request.Mode, request.Mutations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void Commit2() { Mock <Datastore.DatastoreClient> mockGrpcClient = new Mock <Datastore.DatastoreClient>(MockBehavior.Strict); CommitRequest expectedRequest = new CommitRequest { ProjectId = "projectId-1969970175", Mode = CommitRequest.Types.Mode.Unspecified, Mutations = { }, }; CommitResponse expectedResponse = new CommitResponse { IndexUpdates = 1425228195, }; mockGrpcClient.Setup(x => x.Commit(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); DatastoreClient client = new DatastoreClientImpl(mockGrpcClient.Object, null); string projectId = "projectId-1969970175"; CommitRequest.Types.Mode mode = CommitRequest.Types.Mode.Unspecified; IEnumerable <Mutation> mutations = new List <Mutation>(); CommitResponse response = client.Commit(projectId, mode, mutations); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }