/// <summary>Snippet for UpdateField</summary> public void UpdateField() { // Snippet: UpdateField(apis::Field,CallSettings) // Create client FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.Create(); // Initialize request argument(s) apis::Field field = new apis::Field(); // Make the request Operation response = firestoreAdminClient.UpdateField(field); // End snippet }
/// <summary>Snippet for GetField</summary> public void GetField() { // Snippet: GetField(FieldName,CallSettings) // Create client FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.Create(); // Initialize request argument(s) FieldName name = new FieldName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]"); // Make the request apis::Field response = firestoreAdminClient.GetField(name); // End snippet }
/// <summary>Snippet for UpdateFieldAsync</summary> public async Task UpdateFieldAsync() { // Snippet: UpdateFieldAsync(apis::Field,CallSettings) // Additional: UpdateFieldAsync(apis::Field,CancellationToken) // Create client FirestoreAdminClient firestoreAdminClient = await FirestoreAdminClient.CreateAsync(); // Initialize request argument(s) apis::Field field = new apis::Field(); // Make the request Operation response = await firestoreAdminClient.UpdateFieldAsync(field); // End snippet }
/// <summary>Snippet for GetField</summary> public void GetField_RequestObject() { // Snippet: GetField(GetFieldRequest,CallSettings) // Create client FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.Create(); // Initialize request argument(s) GetFieldRequest request = new GetFieldRequest { FieldName = new FieldName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]"), }; // Make the request apis::Field response = firestoreAdminClient.GetField(request); // End snippet }
/// <summary>Snippet for GetFieldAsync</summary> public async Task GetFieldAsync() { // Snippet: GetFieldAsync(FieldName,CallSettings) // Additional: GetFieldAsync(FieldName,CancellationToken) // Create client FirestoreAdminClient firestoreAdminClient = await FirestoreAdminClient.CreateAsync(); // Initialize request argument(s) FieldName name = new FieldName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]"); // Make the request apis::Field response = await firestoreAdminClient.GetFieldAsync(name); // End snippet }
public async Task GetFieldAsync2() { Mock <FirestoreAdmin.FirestoreAdminClient> mockGrpcClient = new Mock <FirestoreAdmin.FirestoreAdminClient>(MockBehavior.Strict); GetFieldRequest request = new GetFieldRequest { FieldName = new FieldName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]"), }; apis::Field expectedResponse = new apis::Field { Name = "name2-1052831874", }; mockGrpcClient.Setup(x => x.GetFieldAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <apis::Field>(Task.FromResult(expectedResponse), null, null, null, null)); FirestoreAdminClient client = new FirestoreAdminClientImpl(mockGrpcClient.Object, null); apis::Field response = await client.GetFieldAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetField2() { Mock <FirestoreAdmin.FirestoreAdminClient> mockGrpcClient = new Mock <FirestoreAdmin.FirestoreAdminClient>(MockBehavior.Strict); GetFieldRequest request = new GetFieldRequest { FieldName = new FieldName("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]"), }; apis::Field expectedResponse = new apis::Field { Name = "name2-1052831874", }; mockGrpcClient.Setup(x => x.GetField(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); FirestoreAdminClient client = new FirestoreAdminClientImpl(mockGrpcClient.Object, null); apis::Field response = client.GetField(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task UpdateFieldAsync() { Mock <FirestoreAdmin.FirestoreAdminClient> mockGrpcClient = new Mock <FirestoreAdmin.FirestoreAdminClient>(MockBehavior.Strict); UpdateFieldRequest expectedRequest = new UpdateFieldRequest { Field = new apis::Field(), }; Operation expectedResponse = new Operation { Name = "name3373707", Done = true, }; mockGrpcClient.Setup(x => x.UpdateFieldAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Operation>(Task.FromResult(expectedResponse), null, null, null, null)); FirestoreAdminClient client = new FirestoreAdminClientImpl(mockGrpcClient.Object, null); apis::Field field = new apis::Field(); Operation response = await client.UpdateFieldAsync(field); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateField() { Mock <FirestoreAdmin.FirestoreAdminClient> mockGrpcClient = new Mock <FirestoreAdmin.FirestoreAdminClient>(MockBehavior.Strict); UpdateFieldRequest expectedRequest = new UpdateFieldRequest { Field = new apis::Field(), }; Operation expectedResponse = new Operation { Name = "name3373707", Done = true, }; mockGrpcClient.Setup(x => x.UpdateField(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); FirestoreAdminClient client = new FirestoreAdminClientImpl(mockGrpcClient.Object, null); apis::Field field = new apis::Field(); Operation response = client.UpdateField(field); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }