Beispiel #1
0
        public void ConstructorSetsInnerFilter()
        {
            var innerFilter = new FakeSettingFilter();

            var filter = new SafelistSettingFilter(new[] { "foo" }, innerFilter);

            filter.InnerFilter.Should().BeSameAs(innerFilter);
        }
        public void ConstructorSetsSettingFilterProperty()
        {
            var receiver = new FakeReceiver("fake");
            var filter   = new FakeSettingFilter();

            var source = new MessagingConfigurationSource(receiver, filter);

            source.SettingFilter.Should().BeSameAs(filter);
        }
        public void ConstructorSetsSettingFilterProperty()
        {
            var receiver = new FakeReceiver("fake");
            var filter   = new FakeSettingFilter();

            MessagingConfigurationProvider provider = typeof(MessagingConfigurationProvider).New(receiver, filter);

            provider.SettingFilter.Should().BeSameAs(filter);
        }
        public void BuildMethodReturnsMessagingConfigurationProvider()
        {
            var receiver = new FakeReceiver("fake");
            var filter   = new FakeSettingFilter();

            var source = new MessagingConfigurationSource(receiver, filter);

            var provider = source.Build(null);

            provider.Should().BeOfType <MessagingConfigurationProvider>();

            var messagingProvider = (MessagingConfigurationProvider)provider;

            messagingProvider.Receiver.Should().BeSameAs(receiver);
            messagingProvider.SettingFilter.Should().BeSameAs(filter);
        }
        public void AddRockLibMessagingProviderExtensionMethod2AddsAMessagingConfigurationSourceToTheConfigurationBuilder()
        {
            var receiver = new FakeReceiver("fake");
            var filter   = new FakeSettingFilter();

            var builder = new ConfigurationBuilder();

            builder.AddRockLibMessagingProvider(receiver, filter);

            builder.Sources.Should().HaveCount(1);
            builder.Sources[0].Should().BeOfType <MessagingConfigurationSource>();

            var source = (MessagingConfigurationSource)builder.Sources[0];

            source.Receiver.Should().BeSameAs(receiver);
            source.SettingFilter.Should().BeSameAs(filter);
        }
        public void AddRockLibMessagingProviderExtensionMethod1AddsAMessagingConfigurationSourceToTheConfigurationBuilder()
        {
            var filter = new FakeSettingFilter();

            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json")
                          .AddRockLibMessagingProvider("fake", filter);

            builder.Sources.Should().HaveCount(2);
            builder.Sources[0].Should().BeOfType <JsonConfigurationSource>();
            builder.Sources[1].Should().BeOfType <MessagingConfigurationSource>();

            var source = (MessagingConfigurationSource)builder.Sources[1];

            source.Receiver.Should().BeOfType <FakeReceiver>();
            source.Receiver.Name.Should().Be("fake");
            source.SettingFilter.Should().BeSameAs(filter);
        }