예제 #1
0
        public void ToSubscriberBuilder_FromSubscriberBuilder()
        {
            // Arrange
            var topics = Fixture.Create <List <string> >();

            var builder = new TopicBuilder(topics.Count + 1, TopicConsumer.Subscriber)
                          .AddTopics(topics);

            // Act
            var subscriberBuilder = builder.ToSubscriberBuilder();

            // Assert
            subscriberBuilder.Levels
            .Should()
            .Be(builder.Levels,
                "because the content of the builder should remain the same");

            subscriberBuilder.TopicCollection.ToArray()
            .Should()
            .Contain(builder.TopicCollection.ToArray(),
                     "because the content of the builder should remain the same");

            subscriberBuilder.Consumer
            .Should()
            .Be(TopicConsumer.Subscriber,
                "because the consumer should have changed for the converted builder");
        }