public void Lookup2() { Mock <Datastore.DatastoreClient> mockGrpcClient = new Mock <Datastore.DatastoreClient>(MockBehavior.Strict); LookupRequest request = new LookupRequest { ProjectId = "projectId-1969970175", Keys = { }, }; LookupResponse expectedResponse = new LookupResponse(); mockGrpcClient.Setup(x => x.Lookup(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); DatastoreClient client = new DatastoreClientImpl(mockGrpcClient.Object, null); LookupResponse response = client.Lookup(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void Lookup() { Mock <Datastore.DatastoreClient> mockGrpcClient = new Mock <Datastore.DatastoreClient>(MockBehavior.Strict); LookupRequest expectedRequest = new LookupRequest { ProjectId = "projectId-1969970175", ReadOptions = new ReadOptions(), Keys = { }, }; LookupResponse expectedResponse = new LookupResponse(); mockGrpcClient.Setup(x => x.Lookup(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); DatastoreClient client = new DatastoreClientImpl(mockGrpcClient.Object, null); string projectId = "projectId-1969970175"; ReadOptions readOptions = new ReadOptions(); IEnumerable <Key> keys = new List <Key>(); LookupResponse response = client.Lookup(projectId, readOptions, keys); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void Lookup() { moq::Mock <Datastore.DatastoreClient> mockGrpcClient = new moq::Mock <Datastore.DatastoreClient>(moq::MockBehavior.Strict); LookupRequest request = new LookupRequest { ReadOptions = new ReadOptions(), Keys = { new Key(), }, ProjectId = "project_id43ad98b0", }; LookupResponse expectedResponse = new LookupResponse { Found = { new EntityResult(), }, Missing = { new EntityResult(), }, Deferred = { new Key(), }, }; mockGrpcClient.Setup(x => x.Lookup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DatastoreClient client = new DatastoreClientImpl(mockGrpcClient.Object, null); LookupResponse response = client.Lookup(request.ProjectId, request.ReadOptions, request.Keys); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }