protected string ComputeSendPortName(ISendPort <TNamingConvention> sendPort)
        {
            if (sendPort.ApplicationBinding == null)
            {
                throw new NamingConventionException(
                          string.Format(
                              "'{0}' SendPort is not bound to application's send port collection.",
                              sendPort.GetType().Name));
            }
            if (Equals(Party, default(TParty)))
            {
                throw new NamingConventionException(
                          string.Format(
                              "'{0}' SendPort's Party is required.",
                              sendPort.GetType().Name));
            }
            if (Equals(MessageName, default(TMessageName)))
            {
                throw new NamingConventionException(
                          string.Format(
                              "'{0}' SendPort's MessageName is required.",
                              sendPort.GetType().Name));
            }
            if (MessageFormat == null)
            {
                throw new NamingConventionException("A non null MessageFormat is required.");
            }

            var area = ComputeArea(sendPort.GetType());

            return(string.Format(
                       "{0}{1}.SP{2}.{3}.{4}.{5}{6}",
                       ((ISupportNamingConvention)sendPort.ApplicationBinding).Name,
                       area.IsNullOrEmpty() ? string.Empty : string.Format(".{0}", area),
                       sendPort.IsTwoWay ? "2" : "1",
                       Party,
                       MessageName,
                       ComputeAdapterName(sendPort.Transport.Adapter),
                       MessageFormat.IsNullOrEmpty() ? string.Empty : string.Format(".{0}", MessageFormat)));
        }
        protected string ComputeSendPortName(ISendPort <TNamingConvention> sendPort)
        {
            if (sendPort == null)
            {
                throw new ArgumentNullException(nameof(sendPort));
            }
            if (sendPort.ApplicationBinding == null)
            {
                throw new NamingConventionException($"'{sendPort.GetType().Name}' SendPort is not bound to application's send port collection.");
            }
            if (Equals(Party, default(TParty)))
            {
                throw new NamingConventionException($"'{sendPort.GetType().Name}' SendPort's Party is required.");
            }
            if (Equals(Subject, default(TSubject)))
            {
                throw new NamingConventionException($"'{sendPort.GetType().Name}' SendPort's Subject is required.");
            }
            if (MessageFormat == null)
            {
                throw new NamingConventionException("A non null MessageFormat is required.");
            }

            var aggregate = ComputeAggregateName(sendPort.GetType());

            return(string.Format(
                       CultureInfo.InvariantCulture,
                       "{0}{1}.SP{2}.{3}.{4}.{5}{6}",
                       sendPort.ApplicationBinding.ResolveName(),
                       aggregate.IsNullOrEmpty() ? string.Empty : $".{aggregate}",
                       sendPort.IsTwoWay ? "2" : "1",
                       Party,
                       Subject,
                       ComputeAdapterName(sendPort.Transport.Adapter),
                       MessageFormat.IsNullOrEmpty() ? string.Empty : $".{MessageFormat}"));
        }