示例#1
0
    /// <summary>
    /// Configures a publisher for a topic.
    /// </summary>
    /// <typeparam name="T">The type of the message to publish.</typeparam>
    /// <param name="configure">A delegate to a method to use to configure a topic.</param>
    /// <returns>
    /// The current <see cref="PublicationsBuilder"/>.
    /// </returns>
    /// <exception cref="ArgumentNullException">
    /// <paramref name="configure"/> is <see langword="null"/>.
    /// </exception>
    public PublicationsBuilder WithTopic <T>(Action <TopicPublicationBuilder <T> > configure)
        where T : Message
    {
        if (configure == null)
        {
            throw new ArgumentNullException(nameof(configure));
        }

        var builder = new TopicPublicationBuilder <T>();

        configure(builder);

        Publications.Add(builder);

        return(this);
    }
示例#2
0
 public WhenUsingTopicPublicationBuilder()
 {
     _sut = new TopicPublicationBuilder <Order>();
 }