Esempio n. 1
0
        public void An_extra_segment_will_cause_the_match_to_fail()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("Gate.Tests.StartupTests.Loader.DefaultConfigurationLoaderTests.Hello.Bar");

            Assert.That(configuration, Is.Null);
        }
Esempio n. 2
0
        public void Load_will_find_assembly_and_type_and_static_method()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("Gate.Builder.Tests.Loader.DefaultConfigurationLoaderTests.Hello");

            _helloCalls = 0;
            configuration(null);
            Assert.That(_helloCalls, Is.EqualTo(1));
        }
Esempio n. 3
0
        public void Calling_a_class_with_multiple_configs_is_okay()
        {
            var loader = new StartupLoader();
            var foo = loader.Load("Gate.Builder.Tests.Loader.MultiConfigs.Foo");
            var bar = loader.Load("Gate.Builder.Tests.Loader.MultiConfigs.Bar");

            MultiConfigs.FooCalls = 0;
            MultiConfigs.BarCalls = 0;

            foo(null);

            Assert.That(MultiConfigs.FooCalls, Is.EqualTo(1));
            Assert.That(MultiConfigs.BarCalls, Is.EqualTo(0));

            bar(null);

            Assert.That(MultiConfigs.FooCalls, Is.EqualTo(1));
            Assert.That(MultiConfigs.BarCalls, Is.EqualTo(1));
        }
Esempio n. 4
0
        public void Startup_Configuration_in_assembly_namespace_will_be_discovered_by_default()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("");
            Startup.ConfigurationCalls = 0;
            configuration(null);
            Assert.That(Startup.ConfigurationCalls, Is.EqualTo(1));

            configuration = loader.Load(null);
            Startup.ConfigurationCalls = 0;
            configuration(null);
            Assert.That(Startup.ConfigurationCalls, Is.EqualTo(1));
        }
Esempio n. 5
0
        public void Method_that_returns_app_action_may_also_be_called()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("Gate.Builder.Tests.Loader.DefaultConfigurationLoaderTests.Alpha");

            var builder = new AppBuilder();
            configuration(builder);
            var app = builder.Materialize<AppDelegate>();

            _alphaCalls = 0;
            app(new Dictionary<string, object>(), null, null);
            Assert.That(_alphaCalls, Is.EqualTo(1));
        }
Esempio n. 6
0
        public void Comma_may_be_used_if_assembly_name_doesnt_match_namespace()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("DifferentNamespace.DoesNotFollowConvention, Gate.Builder.Tests");

            DoesNotFollowConvention.ConfigurationCalls = 0;

            configuration(null);

            Assert.That(DoesNotFollowConvention.ConfigurationCalls, Is.EqualTo(1));
        }
Esempio n. 7
0
        public void Configuration_method_defaults_to_Configuration_if_only_type_name_is_provided()
        {
            var loader = new StartupLoader();
            var configuration = loader.Load("Gate.Builder.Tests.Loader.MultiConfigs");

            MultiConfigs.FooCalls = 0;
            MultiConfigs.BarCalls = 0;
            MultiConfigs.ConfigurationCalls = 0;

            Assert.That(MultiConfigs.FooCalls, Is.EqualTo(0));
            Assert.That(MultiConfigs.BarCalls, Is.EqualTo(0));
            Assert.That(MultiConfigs.ConfigurationCalls, Is.EqualTo(0));

            configuration(null);

            Assert.That(MultiConfigs.FooCalls, Is.EqualTo(0));
            Assert.That(MultiConfigs.BarCalls, Is.EqualTo(0));
            Assert.That(MultiConfigs.ConfigurationCalls, Is.EqualTo(1));
        }