/// <summary>Snippet for DropDatabase</summary> public void DropDatabase_RequestObject() { // Snippet: DropDatabase(DropDatabaseRequest,CallSettings) // Create client DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create(); // Initialize request argument(s) DropDatabaseRequest request = new DropDatabaseRequest { DatabaseAsDatabaseName = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"), }; // Make the request databaseAdminClient.DropDatabase(request); // End snippet }
public async Task DropDatabaseAsync_RequestObject() { // Snippet: DropDatabaseAsync(DropDatabaseRequest,CallSettings) // Create client DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync(); // Initialize request argument(s) DropDatabaseRequest request = new DropDatabaseRequest { Database = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]").ToString(), }; // Make the request await databaseAdminClient.DropDatabaseAsync(request); // End snippet }
public async Task DropDatabaseAsync2() { Mock <DatabaseAdmin.DatabaseAdminClient> mockGrpcClient = new Mock <DatabaseAdmin.DatabaseAdminClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DropDatabaseRequest request = new DropDatabaseRequest { DatabaseAsDatabaseName = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DropDatabaseAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); DatabaseAdminClient client = new DatabaseAdminClientImpl(mockGrpcClient.Object, null); await client.DropDatabaseAsync(request); mockGrpcClient.VerifyAll(); }
public void DropDatabase2() { Mock <DatabaseAdmin.DatabaseAdminClient> mockGrpcClient = new Mock <DatabaseAdmin.DatabaseAdminClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DropDatabaseRequest request = new DropDatabaseRequest { DatabaseAsDatabaseName = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DropDatabase(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); DatabaseAdminClient client = new DatabaseAdminClientImpl(mockGrpcClient.Object, null); client.DropDatabase(request); mockGrpcClient.VerifyAll(); }