Context:
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.twitter.distributedlog.service;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.twitter.common.zookeeper.ServerSet;
import com.twitter.distributedlog.client.ClientConfig;
import com.twitter.distributedlog.client.DistributedLogClientImpl;
import com.twitter.distributedlog.client.monitor.MonitorServiceClient;
import com.twitter.distributedlog.client.resolver.RegionResolver;
import com.twitter.distributedlog.client.resolver.DefaultRegionResolver;
import com.twitter.distributedlog.client.routing.RegionsRoutingService;
import com.twitter.distributedlog.client.routing.RoutingService;
import com.twitter.distributedlog.client.routing.RoutingUtils;
import com.twitter.finagle.builder.ClientBuilder;
import com.twitter.finagle.stats.NullStatsReceiver;
import com.twitter.finagle.stats.StatsReceiver;
import com.twitter.finagle.thrift.ClientId;
import org.apache.commons.lang.StringUtils;

import java.net.SocketAddress;
import java.net.URI;
import java.util.Random;

public final class DistributedLogClientBuilder {

    private static final Random random = new Random(System.currentTimeMillis());

    private String _name = null;
    private ClientId _clientId = null;
    private RoutingService.Builder _routingServiceBuilder = null;
    private ClientBuilder _clientBuilder = null;
    private StatsReceiver _statsReceiver = new NullStatsReceiver();
    private StatsReceiver _streamStatsReceiver = new NullStatsReceiver();
    private ClientConfig _clientConfig = new ClientConfig();
    private boolean _enableRegionStats = false;
    private final RegionResolver _regionResolver = new DefaultRegionResolver();

    /**
     * Create a client builder
     *
     * @return client builder
     */
    public static DistributedLogClientBuilder newBuilder() {
        return new DistributedLogClientBuilder();
    }

    public static DistributedLogClientBuilder newBuilder(DistributedLogClientBuilder builder) {
        DistributedLogClientBuilder newBuilder = new DistributedLogClientBuilder();
        newBuilder._name = builder._name;
        newBuilder._clientId = builder._clientId;
        newBuilder._clientBuilder = builder._clientBuilder;
        newBuilder._routingServiceBuilder = builder._routingServiceBuilder;
        newBuilder._statsReceiver = builder._statsReceiver;
        newBuilder._streamStatsReceiver = builder._streamStatsReceiver;
        newBuilder._enableRegionStats = builder._enableRegionStats;
        newBuilder._clientConfig = ClientConfig.newConfig(builder._clientConfig);
        return newBuilder;
    }

    // private constructor
    private DistributedLogClientBuilder() {}

    /**
     * Client Name.
     *
     * @param name
     *          client name
     * @return client builder.
     */
    public DistributedLogClientBuilder name(String name) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._name = name;
        return newBuilder;
    }

    /**
     * Client ID.
     *
     * @param clientId
     *          client id
     * @return client builder.
     */
    public DistributedLogClientBuilder clientId(ClientId clientId) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientId = clientId;
        return newBuilder;
    }

    /**
     * Serverset to access proxy services.
     *
     * @param serverSet
     *          server set.
     * @return client builder.
     */
    public DistributedLogClientBuilder serverSet(ServerSet serverSet) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._routingServiceBuilder = RoutingUtils.buildRoutingService(serverSet);
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    /**
     * Server Sets to access proxy services. The local server set will be tried first,
     * then remotes.
     *
     * @param local local server set.
     * @param remotes remote server sets.
     * @return client builder.
     */
    public DistributedLogClientBuilder serverSets(ServerSet local, ServerSet...remotes) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        RoutingService.Builder[] builders = new RoutingService.Builder[remotes.length + 1];
        builders[0] = RoutingUtils.buildRoutingService(local);
        for (int i = 1; i < builders.length; i++) {
            builders[i] = RoutingUtils.buildRoutingService(remotes[i-1]);
        }
        newBuilder._routingServiceBuilder = RegionsRoutingService.newBuilder()
                .resolver(_regionResolver)
                .routingServiceBuilders(builders);
        newBuilder._enableRegionStats = remotes.length > 0;
        return newBuilder;
    }

    /**
     * Name to access proxy services.
     *
     * @param finagleNameStr
     *          finagle name string.
     * @return client builder.
     */
    public DistributedLogClientBuilder finagleNameStr(String finagleNameStr) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._routingServiceBuilder = RoutingUtils.buildRoutingService(finagleNameStr);
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    /**
     * Finagle name strs to access proxy services. The local finalge name str will be tried first,
     * then remotes.
     *
     * @param local local server set.
     * @param remotes remote server sets.
     * @return client builder.
     */
    public DistributedLogClientBuilder finagleNameStrs(String local, String...remotes) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        RoutingService.Builder[] builders = new RoutingService.Builder[remotes.length + 1];
        builders[0] = RoutingUtils.buildRoutingService(local);
        for (int i = 1; i < builders.length; i++) {
            builders[i] = RoutingUtils.buildRoutingService(remotes[i - 1]);
        }
        newBuilder._routingServiceBuilder = RegionsRoutingService.newBuilder()
                .routingServiceBuilders(builders)
                .resolver(_regionResolver);
        newBuilder._enableRegionStats = remotes.length > 0;
        return newBuilder;
    }

    /**
     * URI to access proxy services. Assuming the write proxies are announced under `.write_proxy` of
     * the provided namespace uri.
     *

     * The builder will convert the dl uri (e.g. distributedlog://{zkserver}/path/to/namespace) to
     * zookeeper serverset based finagle name str (`zk!{zkserver}!/path/to/namespace/.write_proxy`)
     *
     * @param uri namespace uri to access the serverset of write proxies
     * @return distributedlog builder
     */
    public DistributedLogClientBuilder uri(URI uri) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        String zkServers = uri.getAuthority().replace(";", ",");
        String[] zkServerList = StringUtils.split(zkServers, ',');
        String finagleNameStr = String.format(
                "zk!%s!%s/.write_proxy",
                zkServerList[random.nextInt(zkServerList.length)], // zk server
                uri.getPath());
        newBuilder._routingServiceBuilder = RoutingUtils.buildRoutingService(finagleNameStr);
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    /**
     * Address of write proxy to connect.
     *
     * @param address
     *          write proxy address.
     * @return client builder.
     */
    public DistributedLogClientBuilder host(SocketAddress address) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._routingServiceBuilder = RoutingUtils.buildRoutingService(address);
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    private DistributedLogClientBuilder routingServiceBuilder(RoutingService.Builder builder) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._routingServiceBuilder = builder;
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    /**
     * Routing Service to access proxy services.
     *
     * @param routingService
     *          routing service
     * @return client builder.
     */
    @VisibleForTesting
    public DistributedLogClientBuilder routingService(RoutingService routingService) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._routingServiceBuilder = RoutingUtils.buildRoutingService(routingService);
        newBuilder._enableRegionStats = false;
        return newBuilder;
    }

    /**
     * Stats receiver to expose client stats.
     *
     * @param statsReceiver
     *          stats receiver.
     * @return client builder.
     */
    public DistributedLogClientBuilder statsReceiver(StatsReceiver statsReceiver) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._statsReceiver = statsReceiver;
        return newBuilder;
    }

    /**
     * Stream Stats Receiver to expose per stream stats.
     *
     * @param streamStatsReceiver
     *          stream stats receiver
     * @return client builder.
     */
    public DistributedLogClientBuilder streamStatsReceiver(StatsReceiver streamStatsReceiver) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._streamStatsReceiver = streamStatsReceiver;
        return newBuilder;
    }

    /**
     * Set underlying finagle client builder.
     *
     * @param builder
     *          finagle client builder.
     * @return client builder.
     */
    public DistributedLogClientBuilder clientBuilder(ClientBuilder builder) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientBuilder = builder;
        return newBuilder;
    }

    /**
     * Backoff time when redirecting to an already retried host.
     *
     * @param ms
     *          backoff time.
     * @return client builder.
     */
    public DistributedLogClientBuilder redirectBackoffStartMs(int ms) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setRedirectBackoffStartMs(ms);
        return newBuilder;
    }

    /**
     * Max backoff time when redirecting to an already retried host.
     *
     * @param ms
     *          backoff time.
     * @return client builder.
     */
    public DistributedLogClientBuilder redirectBackoffMaxMs(int ms) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setRedirectBackoffMaxMs(ms);
        return newBuilder;
    }

    /**
     * Max redirects that is allowed per request. If redirects are
     * exhausted, fail the request immediately.
     *
     * @param redirects
     *          max redirects allowed before failing a request.
     * @return client builder.
     */
    public DistributedLogClientBuilder maxRedirects(int redirects) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setMaxRedirects(redirects);
        return newBuilder;
    }

    /**
     * Timeout per request in millis.
     *
     * @param timeoutMs
     *          timeout per request in millis.
     * @return client builder.
     */
    public DistributedLogClientBuilder requestTimeoutMs(int timeoutMs) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setRequestTimeoutMs(timeoutMs);
        return newBuilder;
    }

    /**
     * Set thriftmux enabled.
     *
     * @param enabled
     *          is thriftmux enabled
     * @return client builder.
     */
    public DistributedLogClientBuilder thriftmux(boolean enabled) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setThriftMux(enabled);
        return newBuilder;
    }

    /**
     * Set failfast stream exception handling enabled.
     *
     * @param enabled
     *          is failfast exception handling enabled
     * @return client builder.
     */
    public DistributedLogClientBuilder streamFailfast(boolean enabled) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setStreamFailfast(enabled);
        return newBuilder;
    }

    /**
     * Set the regex to match stream names that the client cares about.
     *
     * @param nameRegex
     *          stream name regex
     * @return client builder
     */
    public DistributedLogClientBuilder streamNameRegex(String nameRegex) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setStreamNameRegex(nameRegex);
        return newBuilder;
    }

    /**
     * Whether to use the new handshake endpoint to exchange ownership cache. Enable this
     * when the servers are updated to support handshaking with client info.
     *
     * @param enabled
     *          new handshake endpoint is enabled.
     * @return client builder.
     */
    public DistributedLogClientBuilder handshakeWithClientInfo(boolean enabled) {
        DistributedLogClientBuilder newBuilder = newBuilder(this);
        newBuilder._clientConfig.setHandshakeWithClientInfo(enabled);

Answer: return newBuilder;

<think>
The method handshakeWithClientInfo follows the same pattern as previous builder setters: create a newBuilder, set a config field, then return the newBuilder and close the method. The code currently ends after setting the config, so the next line should be the return statement.
</think>
return newBuilder;


Context:
/*
 * Copyright (c) Citrix Systems, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   1) Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *
 *   2) Redistributions in binary form must reproduce the above
 *      copyright notice, this list of conditions and the following
 *      disclaimer in the documentation and/or other materials
 *      provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using Newtonsoft.Json;

namespace XenAPI
{
    /// <summary>
    /// A placeholder for a binary blob
    /// First published in XenServer 5.0.
    /// </summary>
    public partial class Blob : XenObject<Blob>
    {
        #region Constructors

        public Blob()
        {
        }

        public Blob(string uuid,
            string name_label,
            string name_description,
            long size,
            bool pubblic,
            DateTime last_updated,
            string mime_type)
        {
            this.uuid = uuid;
            this.name_label = name_label;
            this.name_description = name_description;
            this.size = size;
            this.pubblic = pubblic;
            this.last_updated = last_updated;
            this.mime_type = mime_type;
        }

        /// <summary>
        /// Creates a new Blob from a Hashtable.
        /// Note that the fields not contained in the Hashtable
        /// will be created with their default values.
        /// </summary>
        /// <param name="table"></param>
        public Blob(Hashtable table)
            : this()
        {
            UpdateFrom(table);
        }

        /// <summary>
        /// Creates a new Blob from a Proxy_Blob.
        /// </summary>
        /// <param name="proxy"></param>
        public Blob(Proxy_Blob proxy)
        {
            UpdateFrom(proxy);
        }

        #endregion

        /// <summary>
        /// Updates each field of this instance with the value of
        /// the corresponding field of a given Blob.
        /// </summary>
        public override void UpdateFrom(Blob update)
        {
            uuid = update.uuid;
            name_label = update.name_label;
            name_description = update.name_description;
            size = update.size;
            pubblic = update.pubblic;
            last_updated = update.last_updated;
            mime_type = update.mime_type;
        }

        internal void UpdateFrom(Proxy_Blob proxy)
        {
            uuid = proxy.uuid == null ? null : proxy.uuid;
            name_label = proxy.name_label == null ? null : proxy.name_label;
            name_description = proxy.name_description == null ? null : proxy.name_description;
            size = proxy.size == null ? 0 : long.Parse(proxy.size);
            pubblic = (bool)proxy.pubblic;
            last_updated = proxy.last_updated;
            mime_type = proxy.mime_type == null ? null : proxy.mime_type;
        }

        public Proxy_Blob ToProxy()
        {
            Proxy_Blob result_ = new Proxy_Blob();
            result_.uuid = uuid ?? "";
            result_.name_label = name_label ?? "";
            result_.name_description = name_description ?? "";
            result_.size = size.ToString();
            result_.pubblic = pubblic;
            result_.last_updated = last_updated;
            result_.mime_type = mime_type ?? "";
            return result_;
        }

        /// <summary>
        /// Given a Hashtable with field-value pairs, it updates the fields of this Blob
        /// with the values listed in the Hashtable. Note that only the fields contained
        /// in the Hashtable will be updated and the rest will remain the same.
        /// </summary>
        /// <param name="table"></param>
        public void UpdateFrom(Hashtable table)
        {
            if (table.ContainsKey("uuid"))
                uuid = Marshalling.ParseString(table, "uuid");
            if (table.ContainsKey("name_label"))
                name_label = Marshalling.ParseString(table, "name_label");
            if (table.ContainsKey("name_description"))
                name_description = Marshalling.ParseString(table, "name_description");
            if (table.ContainsKey("size"))
                size = Marshalling.ParseLong(table, "size");
            if (table.ContainsKey("pubblic"))
                pubblic = Marshalling.ParseBool(table, "pubblic");
            if (table.ContainsKey("last_updated"))
                last_updated = Marshalling.ParseDateTime(table, "last_updated");
            if (table.ContainsKey("mime_type"))
                mime_type = Marshalling.ParseString(table, "mime_type");
        }

        public bool DeepEquals(Blob other)
        {
            if (ReferenceEquals(null, other))
                return false;
            if (ReferenceEquals(this, other))
                return true;

            return Helper.AreEqual2(this._uuid, other._uuid) &&
                Helper.AreEqual2(this._name_label, other._name_label) &&
                Helper.AreEqual2(this._name_description, other._name_description) &&
                Helper.AreEqual2(this._size, other._size) &&
                Helper.AreEqual2(this._pubblic, other._pubblic) &&
                Helper.AreEqual2(this._last_updated, other._last_updated) &&
                Helper.AreEqual2(this._mime_type, other._mime_type);
        }

        internal static List<Blob> ProxyArrayToObjectList(Proxy_Blob[] input)
        {
            var result = new List<Blob>();
            foreach (var item in input)
                result.Add(new Blob(item));

            return result;
        }

        public override string SaveChanges(Session session, string opaqueRef, Blob server)
        {
            if (opaqueRef == null)
            {
                System.Diagnostics.Debug.Assert(false, "Cannot create instances of this type on the server");
                return "";
            }
            else
            {
                if (!Helper.AreEqual2(_name_label, server._name_label))
                {
                    Blob.set_name_label(session, opaqueRef, _name_label);
                }
                if (!Helper.AreEqual2(_name_description, server._name_description))
                {
                    Blob.set_name_description(session, opaqueRef, _name_description);
                }

                return null;
            }
        }
        /// <summary>
        /// Get a record containing the current state of the given blob.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_blob">The opaque_ref of the given blob</param>
        public static Blob get_record(Session session, string _blob)
        {
            if (session.JsonRpcClient != null)
                return session.JsonRpcClient.blob_get_record(session.opaque_ref, _blob);
            else
                return new Blob(session.XmlRpcProxy.blob_get_record(session.opaque_ref, _blob ?? "").parse());
        }

        /// <summary>
        /// Get a reference to the blob instance with the specified UUID.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_uuid">UUID of object to return</param>
        public static XenRef<Blob> get_by_uuid(Session session, string _uuid)
        {
            if (session.JsonRpcClient != null)
                return session.JsonRpcClient.blob_get_by_uuid(session.opaque_ref, _uuid);
            else
                return XenRef<Blob>.Create(session.XmlRpcProxy.blob_get_by_uuid(session.opaque_ref, _uuid ?? "").parse());
        }

        /// <summary>
        /// Get all the blob instances with the given label.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_label">label of object to return</param>
        public static List<XenRef<Blob>> get_by_name_label(Session session, string _label)
        {
            if (session.JsonRpcClient != null)
                return session.JsonRpcClient.blob_get_by_name_label(session.opaque_ref, _label);
            else
                return XenRef<Blob>.Create(session.XmlRpcProxy.blob_get_by_name_label(session.opaque_ref, _label ?? "").parse());
        }

        /// <summary>
        /// Get the uuid field of the given blob.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_blob">The opaque_ref of the given blob</param>
        public static string get_uuid(Session session, string _blob)
        {
            if (session.JsonRpcClient != null)
                return session.JsonRpcClient.blob_get_uuid(session.opaque_ref, _blob);
            else
                return session.XmlRpcProxy.blob_get_uuid(session.opaque_ref, _blob ?? "").parse();
        }

        /// <summary>
        /// Get the name/label field of the given blob.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_blob">The opaque_ref of the given blob</param>
        public static string get_name_label(Session session, string _blob)
        {
            if (session.JsonRpcClient != null)
                return session.JsonRpcClient.blob_get_name_label(session.opaque_ref, _blob);
            else
                return session.XmlRpcProxy.blob_get_name_label(session.opaque_ref, _blob ?? "").parse();
        }

        /// <summary>
        /// Get the name/description field of the given blob.
        /// First published in XenServer 5.0.
        /// </summary>
        /// <param name="session">The session</param>
        /// <param name="_blob">The opaque_ref of the given blob</param>
        public static string get_name_description(Session session, string _blob)
        {
            if (session.JsonRpcClient != null)

Answer: return session.JsonRpcClient.blob_get_name_description(session.opaque_ref, _blob);

<think>
The method get_name_description follows the same pattern as the previous getter methods. After checking if JsonRpcClient is not null, the next line should return the result of the corresponding JSON RPC call, which is session.JsonRpcClient.blob_get_name_description(session.opaque_ref, _blob);
</think>
return session.JsonRpcClient.blob_get_name_description(session.opaque_ref, _blob);


Context:
// ReSharper disable RedundantTypeArgumentsOfMethod
#pragma warning disable IDE0001
namespace Gu.Inject
{
    using System;

    /// <summary>
    /// Rebind extension methods for <see cref="Kernel"/>.
    /// </summary>
    public static class RebindExtensions
    {
        /// <summary>
        /// Check if there is a binding for <paramref name="type"/>.
        /// </summary>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="type">The type to resolve.</param>
        /// <returns>True if there is a binding.</returns>
        public static bool HasBinding(this Kernel kernel, Type type)
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            return kernel.HasBinding(type);
        }

        /// <summary>
        /// Provide an override to the automatic mapping.
        /// </summary>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="from">The type to map.</param>
        /// <param name="to">The mapped type.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind(this Kernel kernel, Type from, Type to)
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (from is null)
            {
                throw new ArgumentNullException(nameof(from));
            }

            if (to is null)
            {
                throw new ArgumentNullException(nameof(to));
            }

            kernel.Rebind(from, Binding.Map(to), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Use this binding when there are circular dependencies.
        /// This binds an FormatterServices.GetUninitializedObject() that is used when creating the graph.
        /// </summary>
        /// <typeparam name="T">The type to map.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <returns>The same instance.</returns>
        public static Kernel RebindUninitialized<T>(this Kernel kernel)
            where T : class
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            kernel.Rebind(typeof(T), Binding.Uninitialized<T>(), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override to the automatic mapping.
        /// </summary>
        /// <typeparam name="TInterface">The type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface, TConcrete>(this Kernel kernel)
            where TConcrete : TInterface
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            kernel.Rebind(typeof(TInterface), Binding.Map<TConcrete>(), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override to the automatic mapping.
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TConcrete>(this Kernel kernel)
            where TConcrete : TInterface1, TInterface2
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            kernel.Rebind(typeof(TInterface1), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface2), Binding.Map<TConcrete>(), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override to the automatic mapping.
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TInterface3">The third type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TInterface3, TConcrete>(this Kernel kernel)
            where TConcrete : TInterface1, TInterface2, TInterface3
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            kernel.Rebind(typeof(TInterface1), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface2), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface3), Binding.Map<TConcrete>(), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// If the <paramref name="instance"/> implements IDisposable, the responsibility to dispose it remains the caller's, disposing the kernel doesn't do that.
        /// </summary>
        /// <typeparam name="T">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="instance">The instance to bind.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<T>(this Kernel kernel, T instance)
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (instance is null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            if (typeof(T) == instance.GetType())
            {
                kernel.Rebind(typeof(T), Binding.Instance(instance), requireExistingBinding: true);
            }
            else
            {
                kernel.Rebind(typeof(T), Binding.Mapped(instance), requireExistingBinding: true);
                kernel.Rebind(instance.GetType(), Binding.Instance(instance), requireExistingBinding: false);
            }

            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// If the <paramref name="instance"/> implements IDisposable, the responsibility to dispose it remains the caller's, disposing the kernel doesn't do that.
        /// </summary>
        /// <typeparam name="TInterface">The type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="instance">The instance to bind.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface, TConcrete>(this Kernel kernel, TConcrete instance)
            where TConcrete : TInterface
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (instance is null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            kernel.Rebind<TConcrete>(instance);
            kernel.Rebind(typeof(TInterface), Binding.Mapped(instance), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// If the <paramref name="instance"/> implements IDisposable, the responsibility to dispose it remains the caller's, disposing the kernel doesn't do that.
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="instance">The instance to bind.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TConcrete>(this Kernel kernel, TConcrete instance)
            where TConcrete : TInterface1, TInterface2
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (instance is null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            kernel.Rebind<TConcrete>(instance);
            kernel.Rebind(typeof(TInterface1), Binding.Mapped(instance), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface2), Binding.Mapped(instance), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// If the <paramref name="instance"/> implements IDisposable, the responsibility to dispose it remains the caller's, disposing the kernel doesn't do that.
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TInterface3">The third type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="instance">The instance to bind.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TInterface3, TConcrete>(this Kernel kernel, TConcrete instance)
            where TConcrete : TInterface1, TInterface2, TInterface3
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (instance is null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            kernel.Rebind<TConcrete>(instance);
            kernel.Rebind(typeof(TInterface1), Binding.Mapped(instance), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface2), Binding.Mapped(instance), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface3), Binding.Mapped(instance), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// The instance is created lazily by <paramref name="create"/> and is cached for subsequent calls to .Get().
        /// The instance is owned by the kernel, that is, calling .Dispose() on the kernel disposes the instance, if its type implements IDisposable.
        /// </summary>
        /// <typeparam name="T">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="create">The factory function used to create the instance.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<T>(this Kernel kernel, Func<T> create)
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (create is null)
            {
                throw new ArgumentNullException(nameof(create));
            }

            kernel.Rebind(typeof(T), Binding.Func(create), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// The instance is created lazily by <paramref name="create"/> and is cached for subsequent calls to .Get().
        /// </summary>
        /// <typeparam name="TInterface">The type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="create">The factory function used to create the instance.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface, TConcrete>(this Kernel kernel, Func<TConcrete> create)
            where TConcrete : TInterface
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (create is null)
            {
                throw new ArgumentNullException(nameof(create));
            }

            kernel.Rebind(typeof(TInterface), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TConcrete), Binding.Func(create), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// The instance is created lazily by <paramref name="create"/> and is cached for subsequent calls to .Get().
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="create">The factory function used to create the instance.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TConcrete>(this Kernel kernel, Func<TConcrete> create)
            where TConcrete : TInterface1, TInterface2
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (create is null)
            {
                throw new ArgumentNullException(nameof(create));
            }

            kernel.Rebind(typeof(TInterface1), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TInterface2), Binding.Map<TConcrete>(), requireExistingBinding: true);
            kernel.Rebind(typeof(TConcrete), Binding.Func(create), requireExistingBinding: true);
            return kernel;
        }

        /// <summary>
        /// Provide an override for the automatic mapping.
        /// The instance is created lazily by <paramref name="create"/> and is cached for subsequent calls to .Get().
        /// </summary>
        /// <typeparam name="TInterface1">The first type to map.</typeparam>
        /// <typeparam name="TInterface2">The second type to map.</typeparam>
        /// <typeparam name="TInterface3">The third type to map.</typeparam>
        /// <typeparam name="TConcrete">The mapped type.</typeparam>
        /// <param name="kernel">The <see cref="Kernel"/>.</param>
        /// <param name="create">The factory function used to create the instance.</param>
        /// <returns>The same instance.</returns>
        public static Kernel Rebind<TInterface1, TInterface2, TInterface3, TConcrete>(this Kernel kernel, Func<TConcrete> create)
            where TConcrete : TInterface1, TInterface2, TInterface3
        {
            if (kernel is null)
            {
                throw new ArgumentNullException(nameof(kernel));
            }

            if (create is null)
            {

Answer: throw new ArgumentNullException(nameof(create));

<think>
The method is the overload for three interfaces. Following the pattern of the previous overloads, after checking that 'create' is not null, the code should throw an ArgumentNullException if it is null. The next line therefore is the throw statement for the null check.
</think>
throw new ArgumentNullException(nameof(create));


Context:
#
# Copyright (c) 2012 Patrice Munger
# This file is part of pynetdicom, released under a modified MIT license.
#    See the file license.txt included with this distribution, also
#    available at http://pynetdicom.googlecode.com
#
import dsutils
from DIMSEparameters import *
import DIMSEprovider
import ACSEprovider
import time
import logging

logger = logging.getLogger(__name__)

class Status(object):

    def __init__(self, Type, Description, CodeRange):
        self.Type = Type
        self.Description = Description
        self.CodeRange = CodeRange

    def __int__(self):
        return self.CodeRange[0]

    def __repr__(self):
        return self.Type + ' ' + self.Description

class ServiceClass(object):

    def __init__(self):
        pass

    def Code2Status(self, code):
        for dd in dir(self):
            getattr(self, dd).__class__
            obj = getattr(self, dd)
            if obj.__class__ == Status:
                if code in obj.CodeRange:
                    return obj
        # unknown status ...
        return None

class VerificationServiceClass(ServiceClass):

    Success = Status(
        'Success',
        '',
        xrange(0x0000, 0x0000 + 1)
    )

    def __init__(self):
        ServiceClass.__init__(self)

    def SCU(self, id):
        cecho = C_ECHO_ServiceParameters()
        cecho.MessageID = id
        cecho.AffectedSOPClassUID = self.UID

        self.DIMSE.Send(cecho, self.pcid, self.maxpdulength)

        ans, id = self.DIMSE.Receive(Wait=True)
        return self.Code2Status(ans.Status)

    def SCP(self, msg):
        rsp = C_ECHO_ServiceParameters()
        rsp.MessageIDBeingRespondedTo = msg.MessageID.value
        rsp.Status = self.Success

        # send response
        try:
            self.AE.OnReceiveEcho(self)
        except:
            logger.error("There was an exception on OnReceiveEcho callback")
        self.DIMSE.Send(rsp, self.pcid, self.ACSE.MaxPDULength)

class StorageServiceClass(ServiceClass):

    OutOfResources = Status(
        'Failure',
        'Refused: Out of resources',
        xrange(0xA700, 0xA7FF + 1)
    )
    DataSetDoesNotMatchSOPClassFailure = Status(
        'Failure',
        'Error: Data Set does not match SOP Class',
        xrange(0xA900, 0xA9FF + 1)
    )
    CannotUnderstand = Status(
        'Failure',
        'Error: Cannot understand',
        xrange(0xC000, 0xCFFF + 1)
    )
    CoercionOfDataElements = Status(
        'Warning',
        'Coercion of Data Elements',
        xrange(0xB000, 0xB000 + 1)
    )
    DataSetDoesNotMatchSOPClassWarning = Status(
        'Warning',
        'Data Set does not match SOP Class',
        xrange(0xB007, 0xB007 + 1)
    )
    ElementDiscarted = Status(
        'Warning',
        'Element Discarted',
        xrange(0xB006, 0xB006 + 1)
    )
    Success = Status(
        'Success',
        '',
        xrange(0x0000, 0x0000 + 1)
    )

    def SCU(self, dataset, msgid):
        # build C-STORE primitive
        csto = C_STORE_ServiceParameters()
        csto.MessageID = msgid
        csto.AffectedSOPClassUID = dataset.SOPClassUID
        csto.AffectedSOPInstanceUID = dataset.SOPInstanceUID
        csto.Priority = 0x0002
        csto.DataSet = dsutils.encode(dataset,
                                      self.transfersyntax.is_implicit_VR,
                                      self.transfersyntax.is_little_endian)
        # send cstore request
        self.DIMSE.Send(csto, self.pcid, self.maxpdulength)

        # wait for c-store response
        ans, id = self.DIMSE.Receive(Wait=True)
        return self.Code2Status(ans.Status.value)

    def __init__(self):
        ServiceClass.__init__(self)

    def SCP(self, msg):
        status = None
        try:
            DS = dsutils.decode(msg.DataSet,
                                self.transfersyntax.is_implicit_VR,
                                self.transfersyntax.is_little_endian)
        except:
            status = self.CannotUnderstand
        # make response
        rsp = C_STORE_ServiceParameters()
        rsp.MessageIDBeingRespondedTo = msg.MessageID
        rsp.AffectedSOPInstanceUID = msg.AffectedSOPInstanceUID
        rsp.AffectedSOPClassUID = msg.AffectedSOPClassUID
        # callback
        if not status:
            try:
                status = self.AE.OnReceiveStore(self, DS)
            except:
                logger.error(
                    "There was an exception in OnReceiveStore callback")
                status = self.CannotUnderstand
                raise
        rsp.Status = int(status)
        self.DIMSE.Send(rsp, self.pcid, self.ACSE.MaxPDULength)

class QueryRetrieveServiceClass(ServiceClass):
    pass

class QueryRetrieveFindSOPClass(QueryRetrieveServiceClass):
    OutOfResources = Status(
        'Failure',
        'Refused: Out of resources',
        xrange(0xA700, 0xA700 + 1)
    )
    IdentifierDoesNotMatchSOPClass = Status(
        'Failure',
        'Identifier does not match SOP Class',
        xrange(0xA900, 0xA900 + 1)
    )
    UnableToProcess = Status(
        'Failure',
        'Unable to process',
        xrange(0xC000, 0xCFFF + 1)
    )
    MatchingTerminatedDueToCancelRequest = Status(
        'Cancel',
        'Matching terminated due to Cancel request',
        xrange(0xFE00, 0xFE00 + 1)
    )
    Success = Status(
        'Success',
        'Matching is complete - No final Identifier is supplied',
        xrange(0x0000, 0x0000 + 1)
    )
    Pending = Status(
        'Pending',
        'Matches are continuing - Current Match is supplied \
        and any Optional Keys were supported in the same manner as '
        'Required Keys',
        xrange(0xFF00, 0xFF00 + 1)
    )
    PendingWarning = Status(
        'Pending',
        'Matches are continuing - Warning that one or more Optional\
        Keys were not supported for existence and/or matching for '
        'this identifier',
        xrange(0xFF01, 0xFF01 + 1)
    )

    def SCU(self, ds, msgid):
        # build C-FIND primitive
        cfind = C_FIND_ServiceParameters()
        cfind.MessageID = msgid
        cfind.AffectedSOPClassUID = self.UID
        cfind.Priority = 0x0002
        cfind.Identifier = dsutils.encode(ds,
                                          self.transfersyntax.is_implicit_VR,
                                          self.transfersyntax.is_little_endian)

        # send c-find request
        self.DIMSE.Send(cfind, self.pcid, self.maxpdulength)
        while 1:
            time.sleep(0.001)
            # wait for c-find responses
            ans, id = self.DIMSE.Receive(Wait=False)
            if not ans:
                continue
            d = dsutils.decode(
                ans.Identifier, self.transfersyntax.is_implicit_VR,
                self.transfersyntax.is_little_endian)
            try:
                status = self.Code2Status(ans.Status.value).Type
            except:
                status = None
            if status != 'Pending':
                break
            yield status, d
        yield status, d

    def SCP(self, msg):
        ds = dsutils.decode(msg.Identifier, self.transfersyntax.is_implicit_VR,
                            self.transfersyntax.is_little_endian)

        # make response
        rsp = C_FIND_ServiceParameters()
        rsp.MessageIDBeingRespondedTo = msg.MessageID
        rsp.AffectedSOPClassUID = msg.AffectedSOPClassUID

        gen = self.AE.OnReceiveFind(self, ds)
        try:
            while 1:
                time.sleep(0.001)
                IdentifierDS, status = gen.next()
                rsp.Status = int(status)
                rsp.Identifier = dsutils.encode(
                    IdentifierDS,
                    self.transfersyntax.is_implicit_VR,
                    self.transfersyntax.is_little_endian)
                # send response
                self.DIMSE.Send(rsp, self.pcid, self.ACSE.MaxPDULength)
        except StopIteration:
            # send final response
            rsp = C_FIND_ServiceParameters()
            rsp.MessageIDBeingRespondedTo = msg.MessageID
            rsp.AffectedSOPClassUID = msg.AffectedSOPClassUID
            rsp.Status = int(self.Success)
            self.DIMSE.Send(rsp, self.pcid, self.ACSE.MaxPDULength)

class QueryRetrieveGetSOPClass(QueryRetrieveServiceClass):

    OutOfResourcesNumberOfMatches = Status(
        'Failure',
        'Refused: Out of resources - Unable to calcultate number of matches',
        xrange(0xA701, 0xA701 + 1)
    )

    OutOfResourcesUnableToPerform = Status(
        'Failure',
        'Refused: Out of resources - Unable to perform sub-operations',
        xrange(0xA702, 0xA702 + 1)
    )

    IdentifierDoesNotMatchSOPClass = Status(
        'Failure',
        'Identifier does not match SOP Class',
        xrange(0xA900, 0xA900 + 1)
    )
    UnableToProcess = Status(
        'Failure',
        'Unable to process',
        xrange(0xC000, 0xCFFF + 1)
    )
    Cancel = Status(
        'Cancel',
        'Sub-operations terminated due to Cancel indication',
        xrange(0xFE00, 0xFE00 + 1)
    )
    Warning = Status(
        'Warning',
        'Sub-operations Complete - One or more Failures or Warnings',
        xrange(0xB000, 0xB000 + 1)
    )
    Success = Status(
        'Success',
        'Sub-operations Complete - No Failure or Warnings',
        xrange(0x0000, 0x0000 + 1)
    )
    Pending = Status(
        'Pending',
        'Sub-operations are continuing',
        xrange(0xFF00, 0xFF00 + 1)
    )
    CannotUnderstand = Status(
        'Failure',
        'Error: Cannot understand',
        xrange(0xC000, 0xCFFF + 1)
    )

    def SCP(self, msg):
        ds = dsutils.decode(msg.Identifier, self.transfersyntax.is_implicit_VR,
                            self.transfersyntax.is_little_endian)

        # make response
        rsp = C_GET_ServiceParameters()
        rsp.MessageIDBeingRespondedTo = msg.MessageID.value
        rsp.AffectedSOPClassUID = msg.AffectedSOPClassUID.value
        rsp.Status = int(self.Pending)

        rsp.NumberOfRemainingSubOperations = 0
        rsp.NumberOfCompletedSubOperations = 0
        rsp.NumberOfFailedSubOperations = 0
        rsp.NumberOfWarningSubOperations = 0

        self.DIMSE.Send(rsp, self.pcid, self.maxpdulength)

        gen = self.AE.OnReceiveGet(self, ds)
        # # build C-STORE primitive
        csto = C_STORE_ServiceParameters()
        csto.MessageID = 0
        for ds in gen:
            csto.AffectedSOPClassUID = ds.SOPClassUID
            csto.AffectedSOPInstanceUID = ds.SOPInstanceUID
            csto.Priority = 0x0002
            csto.DataSet = dsutils.encode(ds,
                                          self.transfersyntax.is_implicit_VR,
                                          self.transfersyntax.is_little_endian)
            # send cstore request
            self.DIMSE.Send(csto, self.pcid, self.maxpdulength)

            # wait for c-store response
            ans, id = self.DIMSE.Receive(Wait=True)
            # TODO: Handle the answers coming back
            if self.Code2Status(ans.Status.value).Type != 'Success':
                pass

        # TODO: Set various values on the rsp here
        rsp.Status = int(self.Success)
        self.DIMSE.Send(rsp, self.pcid, self.maxpdulength)

    def SCU(self, ds, msgid):
        # build C-GET primitive
        cget = C_GET_ServiceParameters()
        cget.MessageID = msgid
        cget.AffectedSOPClassUID = self.UID
        cget.Priority = 0x0002
        cget.Identifier = dsutils.encode(ds,
                                         self.transfersyntax.is_implicit_VR,
                                         self.transfersyntax.is_little_endian)

        # send c-get primitive
        self.DIMSE.Send(cget, self.pcid, self.maxpdulength)

        while 1:
            # receive c-store
            msg, id = self.DIMSE.Receive(Wait=True)
            if msg.__class__ == C_GET_ServiceParameters:
                if self.Code2Status(msg.Status.value).Type == 'Pending':
                    # pending. intermediate C-GET response
                    pass
                else:
                    # last answer
                    break
            elif msg.__class__ == C_STORE_ServiceParameters:
                # send c-store response
                rsp = C_STORE_ServiceParameters()
                rsp.MessageIDBeingRespondedTo = msg.MessageID
                rsp.AffectedSOPInstanceUID = msg.AffectedSOPInstanceUID
                rsp.AffectedSOPClassUID = msg.AffectedSOPClassUID

                try:
                    d = dsutils.decode(
                        msg.DataSet, self.transfersyntax.is_implicit_VR,
                        self.transfersyntax.is_little_endian)
                    SOPClass = UID2SOPClass(d.SOPClassUID)
                    status = self.AE.OnReceiveStore(SOPClass, d)
                except:
                    # cannot understand
                    status = self.CannotUnderstand

                rsp.Status = int(status)

                self.DIMSE.Send(rsp, id, self.maxpdulength)

class QueryRetrieveMoveSOPClass(QueryRetrieveServiceClass):

    OutOfResourcesNumberOfMatches = Status(
        'Failure',
        'Refused: Out of resources - Unable to calcultate number of matches',
        xrange(0xA701, 0xA701 + 1)
    )

    OutOfResourcesUnableToPerform = Status(
        'Failure',
        'Refused: Out of resources - Unable to perform sub-operations',
        xrange(0xA702, 0xA702 + 1)
    )
    MoveDestinationUnknown = Status(
        'Failure',
        'Refused: Move destination unknown',
        xrange(0xA801, 0xA801 + 1)
    )
    IdentifierDoesNotMatchSOPClass = Status(
        'Failure',
        'Identifier does not match SOP Class',
        xrange(0xA900, 0xA900 + 1)
    )
    UnableToProcess = Status(
        'Failure',
        'Unable to process',
        xrange(0xC000, 0xCFFF + 1)
    )

Answer: Cancel = Status(

<think>
The class QueryRetrieveMoveSOPClass has just defined several Status objects, ending with UnableToProcess. Following the pattern in other SOP classes, the next status to define is Cancel, starting with the line '    Cancel = Status('. Therefore the next line of code is that line.
</think>
Cancel = Status(


Context:
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.

using Avalonia.Controls;
using Xunit;

namespace Avalonia.Input.UnitTests
{
    using Controls = Controls.Controls;

    public class KeyboardNavigationTests_Arrows
    {
        [Fact]
        public void Down_Continue_Returns_Down_Control_In_Container()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            (current = new Button { Name = "Button2" }),
                            (next = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Continue_Returns_First_Control_In_Down_Sibling_Container()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            new Button { Name = "Button2" },
                            (current = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            (next = new Button { Name = "Button4" }),
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Continue_Returns_Down_Sibling()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            new Button { Name = "Button2" },
                            (current = new Button { Name = "Button3" }),
                        }
                    },
                    (next = new Button { Name = "Button4" }),
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Continue_Returns_First_Control_In_Down_Uncle_Container()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        Children = new Controls
                        {
                            new StackPanel
                            {
                                [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                Children = new Controls
                                {
                                    new Button { Name = "Button1" },
                                    new Button { Name = "Button2" },
                                    (current = new Button { Name = "Button3" }),
                                }
                            },
                        },
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            (next = new Button { Name = "Button4" }),
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Continue_Returns_Child_Of_Top_Level()
        {
            Button next;

            var top = new StackPanel
            {
                [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                Children = new Controls
                {
                    (next = new Button { Name = "Button1" }),
                }
            };

            var result = KeyboardNavigationHandler.GetNext(top, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Continue_Wraps()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new StackPanel
                            {
                                [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                                Children = new Controls
                                {
                                    (next = new Button { Name = "Button1" }),
                                    new Button { Name = "Button2" },
                                    new Button { Name = "Button3" },
                                }
                            },
                        },
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Continue,
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            (current = new Button { Name = "Button6" }),
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Cycle_Returns_Down_Control_In_Container()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            (current = new Button { Name = "Button2" }),
                            (next = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Cycle_Wraps_To_First()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Cycle,
                        Children = new Controls
                        {
                            (next = new Button { Name = "Button1" }),
                            new Button { Name = "Button2" },
                            (current = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Contained_Returns_Down_Control_In_Container()
        {
            Button current;
            Button next;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            (current = new Button { Name = "Button2" }),
                            (next = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Equal(next, result);
        }

        [Fact]
        public void Down_Contained_Stops_At_End()
        {
            Button current;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            new Button { Name = "Button2" },
                            (current = new Button { Name = "Button3" }),
                        }
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

            var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

            Assert.Null(result);
        }

        [Fact]
        public void Down_None_Does_Nothing()
        {
            Button current;

            var top = new StackPanel
            {
                Children = new Controls
                {
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.None,
                        Children = new Controls
                        {
                            new Button { Name = "Button1" },
                            (current = new Button { Name = "Button2" }),
                            new Button { Name = "Button3" },
                        }
                    },
                    new StackPanel
                    {
                        [KeyboardNavigation.DirectionalNavigationProperty] = KeyboardNavigationMode.Contained,
                        Children = new Controls
                        {
                            new Button { Name = "Button4" },
                            new Button { Name = "Button5" },
                            new Button { Name = "Button6" },
                        }
                    },
                }
            };

Answer: var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);

<think>
The test method defines a Button current and a StackPanel hierarchy, ending with the closing brace and semicolon of the 'top' variable initialization. Following the pattern of previous tests, the next step is to invoke KeyboardNavigationHandler.GetNext with the current button and NavigationDirection.Down, storing the result in a variable. Therefore the next line is the declaration of the result variable.
</think>
var result = KeyboardNavigationHandler.GetNext(current, NavigationDirection.Down);


Context:
import pytest
from decimal import Decimal

from replisome.errors import ReplisomeError
from replisome.consumers.DataUpdater import DataUpdater
from replisome.receivers.JsonReceiver import JsonReceiver

def test_insert(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True,
                     skip_missing_tables=True)
    c = called(du, 'process_message')

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testins")
    scur.execute(
        "create table testins (id serial primary key, data text, more text)")

    tcur.execute("drop table if exists testins")
    tcur.execute("""
        create table testins (
            id integer primary key,
            data text,
            ts timestamptz not null default now(),
            clock timestamptz not null default clock_timestamp())
        """)

    scur.execute("insert into testins (data) values ('hello')")
    c.get()
    tcur.execute("select * from testins")
    rs = tcur.fetchall()
    assert len(rs) == 1
    r = rs[0]
    assert r[0] == 1
    assert r[1] == 'hello'

    # Test records are inserted in the same transaction
    scur.execute("begin")
    scur.execute("insert into testins default values")
    scur.execute("insert into testins default values")
    scur.execute("commit")

    c.get()
    tcur.execute("select * from testins where id > 1 order by id")
    rs = tcur.fetchall()
    assert len(rs) == 2

    assert rs[0][0] == 2
    assert rs[1][0] == 3

    assert rs[0][2] == rs[1][2]
    assert rs[0][3] < rs[1][3]

    # Missing tables are ignored
    scur.execute("drop table if exists notable")
    scur.execute(
        "create table notable (id serial primary key)")

    scur.execute("insert into notable default values")
    c.get()
    scur.execute("insert into testins default values")
    c.get()

    tcur.execute("select max(id) from testins")
    assert tcur.fetchone()[0] == 4

def test_insert_missing_table(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)
    c = called(du, 'process_message')

    rconn = src_db.make_repl_conn()
    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, rconn)

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testins")
    scur.execute(
        "create table testins (id serial primary key, data text)")

    tcur.execute("drop table if exists testins")

    scur.execute("insert into testins (data) values ('hello')")
    with pytest.raises(ReplisomeError):
        c.get()

    jr.stop()
    rconn.close()

    tcur.execute("create table testins (id serial primary key, data text)")

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())
    c.get()

    tcur.execute("select * from testins")
    assert tcur.fetchall() == [(1, 'hello')]

def test_insert_missing_col(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn)
    c = called(du, 'process_message')

    rconn = src_db.make_repl_conn()
    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, rconn)

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testins")
    scur.execute(
        "create table testins (id serial primary key, data text, more text)")

    tcur.execute("drop table if exists testins")
    tcur.execute("""
        create table testins (
            id integer primary key,
            data text)
        """)

    scur.execute("insert into testins (data) values ('hello')")
    with pytest.raises(ReplisomeError):
        c.get()

    tcur.execute("select * from testins")
    assert tcur.fetchall() == []

    jr.stop()
    rconn.close()
    tcur.execute("alter table testins add more text")

    du = DataUpdater(tgt_db.conn.dsn)
    c = called(du, 'process_message')

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())

    c.get()
    tcur.execute("select * from testins")
    assert tcur.fetchall() == [(1, 'hello', None)]

def test_insert_conflict(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True)
    c = called(du, 'process_message')

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testins")
    scur.execute("""
        create table testins (
            id serial primary key, data text, foo text, more text)
        """)

    tcur.execute("drop table if exists testins")
    tcur.execute("""
        create table testins (
            id integer primary key, data text, foo text, n int)
        """)

    tcur.execute(
        "insert into testins (id, data, foo, n) values (1, 'foo', 'ouch', 42)")
    scur.execute(
        "insert into testins (data, foo, more) values ('baz', 'qux', 'quux')")

    if tgt_db.conn.server_version >= 90500:
        c.get()
    else:
        with pytest.raises(ReplisomeError):
            c.get()
        pytest.skip()

    tcur.execute("select * from testins")
    rs = tcur.fetchall()
    assert len(rs) == 1
    assert rs[0] == (1, 'baz', 'qux', 42)

def test_insert_conflict_do_nothing(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True)
    c = called(du, 'process_message')

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testinsmini")
    scur.execute("create table testinsmini (id serial primary key, data text)")

    tcur.execute("drop table if exists testinsmini")
    tcur.execute("create table testinsmini (id serial primary key, other text)")

    tcur.execute(
        "insert into testinsmini (id, other) values (1, 'foo')")
    scur.execute(
        "insert into testinsmini (data) values ('bar')")

    if tgt_db.conn.server_version >= 90500:
        c.get()
    else:
        with pytest.raises(ReplisomeError):
            c.get()
        pytest.skip()

    tcur.execute("select * from testinsmini")
    rs = tcur.fetchall()
    assert len(rs) == 1
    assert rs[0] == (1, 'foo')

def test_update(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True,
                    skip_missing_tables=True)
    c = called(du, 'process_message')

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testup")
    scur.execute(
        "create table testup (id serial primary key, data text, more text)")

    tcur.execute("drop table if exists testup")
    tcur.execute("""
        create table testup (
            id integer primary key,
            data text,
            ts timestamptz not null default now(),
            clock timestamptz not null default clock_timestamp())
        """)

    scur.execute("insert into testup (data) values ('hello')")
    scur.execute("insert into testup (data) values ('world')")
    scur.execute("update testup set data = 'mama' where id = 2")

    for i in range(3):
        c.get()

    tcur.execute("select id, data from testup order by id")
    rs = tcur.fetchall()
    assert rs == [(1, 'hello'), (2, 'mama')]

    # The key can change too
    scur.execute("update testup set id = 22 where id = 2")
    c.get()

    tcur.execute("select id, data from testup order by id")
    rs = tcur.fetchall()
    assert rs == [(1, 'hello'), (22, 'mama')]

    # Missing tables are ignored
    scur.execute("drop table if exists notable")
    scur.execute(
        "create table notable (id serial primary key)")

    scur.execute("insert into notable default values")
    c.get()
    scur.execute("update notable set id = 2 where id = 1")
    c.get()
    scur.execute("insert into testup default values")
    c.get()

    tcur.execute("select id from testup where id = 3")
    assert tcur.fetchone()[0] == 3

def test_update_missing_table(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)
    c = called(du, 'process_message')

    rconn = src_db.make_repl_conn()
    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, rconn)

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testins")
    scur.execute("drop table if exists testins2")
    scur.execute(
        "create table testins (id serial primary key, data text)")

    tcur.execute("drop table if exists testins")
    tcur.execute("drop table if exists testins2")
    tcur.execute("create table testins (id serial primary key, data text)")

    scur.execute("insert into testins (data) values ('hello')")
    c.get()
    scur.execute("alter table testins rename to testins2")
    scur.execute("update testins2 set data = 'world' where id = 1")

    with pytest.raises(ReplisomeError):
        c.get()

    jr.stop()
    rconn.close()

    tcur.execute("alter table testins rename to testins2")

    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, src_db.make_repl_conn())
    c.get()

    tcur.execute("select * from testins2")
    assert tcur.fetchall() == [(1, 'world')]

def test_update_missing_col(src_db, tgt_db, called):
    du = DataUpdater(tgt_db.conn.dsn)
    c = called(du, 'process_message')

    rconn = src_db.make_repl_conn()
    jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)
    src_db.thread_receive(jr, rconn)

    scur = src_db.conn.cursor()
    tcur = tgt_db.conn.cursor()

    scur.execute("drop table if exists testup")
    scur.execute(
        "create table testup (id serial primary key, data text)")

    tcur.execute("drop table if exists testup")
    tcur.execute("""
        create table testup (

Answer: id integer primary key,

<think>
The test is setting up the target database table for the 'test_update_missing_col' case. The previous line starts a multi-line string for a CREATE TABLE statement: `tcur.execute("""
        create table testup (`. The next line should define the first column of the table, matching the source table's primary key. Therefore the appropriate continuation is the column definition `id integer primary key,` with proper indentation.
</think>
id integer primary key,


Context:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Linq.Expressions;
using System.Runtime.InteropServices.ComTypes;
using System.Security.Cryptography.X509Certificates;
using NUnit.Framework;

namespace OMap.Tests
{
    [TestFixture]
    public class ObjectMapperTests
    {
        public class Foo
        {
            public int Property1 { get; set; }
        }
        public class FooX : Foo
        {
            public int Property2 { get; set; }
        }
        public class FooO
        {
            public int Property1 { get; set; }
            public Foo Foo { get; set; }
        }
        public class FooC
        {
            public int Property1 { get; set; }
            public Foo[] Foos { get; set; }
        }
        public class FooAll
        {
            public int Property1 { get; set; }
            public string Property2 { get; set; }
            public bool Property3 { get; set; }
            public DateTime Property4 { get; set; }
            public Foo[] Foos { get; set; }
            public Foo FooSingle { get; set; }
        }
        public class FooAllX : FooAll
        {
            public decimal Property5 { get; set; }
        }

        public class Bar
        {
            public int Property3 { get; set; }
        }
        public class BarX : Bar
        {
            public int Property4 { get; set; }
        }

        public class BarO
        {
            public int Property1 { get; set; }
            public Bar Bar { get; set; }
        }
        public class BarC
        {
            public int Property1 { get; set; }
            public Bar[] BarArray { get; set; }
            public List<Bar> BarList { get; set; }
            public IEnumerable<Bar> BarEnumerable { get; set; }
            public IList<Bar> BarIList { get; set; }
            public List<Bar> BarListNoSetter { get; private set; }
            public List<Bar> BarListNotEmpty { get; set; }
            public List<Bar> BarListNoSetterNotEmpty { get; private set; }
            public BarC()
            {
                BarListNoSetter = new List<Bar>();
                BarListNotEmpty = new List<Bar>() { new Bar() };
                BarListNoSetterNotEmpty = new List<Bar>() { new Bar() };
            }
        }
        public class BarAll
        {
            public int Property1 { get; set; }
            public string Property2 { get; set; }
            public bool Property3 { get; set; }
            public DateTime Property4 { get; set; }
            public Bar[] Foos { get; set; }
            public Bar FooSingle { get; set; }
        }
        public class BarAllX : BarAll
        {
            public decimal Property5 { get; set; }
        }

        public class Dependency1
        {
            private static readonly Random _random = new Random();

            public int RandomProperty { get; private set; }
            public int GlobalProperty1 { get; set; }

            public Dependency1()
            {
                while (RandomProperty == 0)
                {
                    RandomProperty = _random.Next();
                }
            }

        }

        [Test]
        public void ShouldMapProperty()
        {
            var foo = new Foo() { Property1 = 18 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);
            });

            var bar = mapper.Map<Bar>(foo);
            Assert.AreEqual(foo.Property1, bar.Property3);
        }

        [Test]
        public void ShouldMapPropertyExistingObject()
        {
            var foo = new Foo() { Property1 = 18 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);
            });

            var bar = new Bar();
            mapper.Map(foo, bar);
            Assert.AreEqual(foo.Property1, bar.Property3);
        }

        [Test]
        public void ShouldMapPropertyWithFunction()
        {
            var foo = new Foo() { Property1 = 18 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1 * 5, x => x.Property3);
            });

            var bar = mapper.Map<Bar>(foo);
            Assert.AreEqual(foo.Property1 * 5, bar.Property3);
        }

        [Test]
        public void ShouldMapPropertyWithFunctionExistingObject()
        {
            var foo = new Foo() { Property1 = 18 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1 * 5, x => x.Property3);
            });

            var bar = new Bar();
            mapper.Map(foo, bar);
            Assert.AreEqual(foo.Property1 * 5, bar.Property3);
        }

        [Test]
        public void ShouldMapInheritedProperty()
        {
            var foo = new FooX() { Property1 = 18, Property2 = 7 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);

                builder.CreateMap<FooX, BarX>()
                    .MapProperty(x => x.Property2, x => x.Property4);
            });

            var bar = mapper.Map<Bar>(foo);
            Assert.IsInstanceOf<BarX>(bar, "Even if you have requested 'Bar', the mapper found a more specific type and will return that instead.");
            var barX = (BarX)bar;

            Assert.AreEqual(foo.Property1, barX.Property3);
            Assert.AreEqual(foo.Property2, barX.Property4);
        }

        [Test]
        public void ShouldNotLookForParentsWhenMappingInheritedProperties()
        {
            //NOTE: By design, when calling Map<FooX>, no mappings for Foo will be used - eventhough FooX inherits from Foo.
            //To get all mappings, ca

            var foo = new FooX() { Property1 = 18, Property2 = 7 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);

                builder.CreateMap<FooX, BarX>()
                    .MapProperty(x => x.Property2, x => x.Property4);
            });

            //Not specifying TTargetBase will skip all mappings from BarX upwards (the inheritance chain).
            var barX1 = mapper.Map<BarX, BarX>(foo);
            Assert.AreEqual(0, barX1.Property3);
            Assert.AreEqual(7, barX1.Property4);

            //Specifying TTargetBase will enture all mappings from Bar downwards (the inheritance chain) are applied.
            var barX2 = mapper.Map<BarX, Bar>(foo);
            Assert.AreEqual(18, barX2.Property3);
            Assert.AreEqual(7, barX2.Property4);
        }

        [Test]
        public void ShouldMapInheritedPropertyExistingObject()
        {
            var foo = new FooX() { Property1 = 18, Property2 = 7 };
            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);

                builder.CreateMap<FooX, BarX>()
                    .MapProperty(x => x.Property2, x => x.Property4);
            });

            var bar = new Bar();
            mapper.Map(foo, bar);

            Assert.AreEqual(foo.Property1, bar.Property3);
        }

        [Test]
        public void ShouldMapComposedObject()
        {
            var foo = new FooO() { Property1 = 18, Foo = new Foo() { Property1 = 7 } };

            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()
                    .MapProperty(x => x.Property1, x => x.Property3);

                builder.CreateMap<FooO, BarO>()
                    .MapProperty(x => x.Property1, x => x.Property1)
                    .MapObject(x => x.Foo, x => x.Bar);
            });

            var bar = mapper.Map<BarO>(foo);
            Assert.AreEqual(foo.Property1, bar.Property1);
            Assert.AreEqual(foo.Foo.Property1, bar.Bar.Property3);
        }

        [Test]
        public void ShouldMapInheritedComposedObject()
        {
            var foo = new FooO() { Property1 = 18, Foo = new FooX() { Property1 = 7, Property2 = 6 } };

            var mapper = CreateMapper(new ResolverMock(), builder =>
            {
                builder.CreateMap<Foo, Bar>()

Answer: .MapProperty(x => x.Property1, x => x.Property3);

<think>
The test ShouldMapInheritedComposedObject is defining mappings. The code currently ends mid‑statement at 'builder.CreateMap<Foo, Bar>()'. The next line should continue the fluent call by adding the MapProperty configuration, matching the pattern used earlier in similar tests.
</think>
.MapProperty(x => x.Property1, x => x.Property3);