コード例 #1
0
        public void does_not_set_a_property_that_is_not_explicitly_configured()
        {
            var host = new HostManifest("h1");

            host.RegisterSettings(data4);

            // the default value for Name is "somebody"
            host.GetDirective <OneDirective>().Name.ShouldEqual("somebody");
        }
コード例 #2
0
        public void can_pull_setting_class_out_of_request_data()
        {
            var host = new HostManifest("host1");

            host.RegisterSettings(data3);

            var directive = host.GetDirective <TwoDirective>();

            directive.City.ShouldEqual("Austin");
            directive.IsDomestic.ShouldBeTrue();
        }
コード例 #3
0
        public void can_pull_setting_class_out_of_multiple_data_settings_with_no_conflict()
        {
            var host = new HostManifest("host1");

            host.RegisterSettings(data1);
            host.RegisterSettings(data4);

            var directive = host.GetDirective <OneDirective>();

            directive.Name.ShouldEqual("Max");
            directive.Age.ShouldEqual(7);
        }
コード例 #4
0
ファイル: HostManifestTester.cs プロジェクト: cprieto/fubumvc
        public void append_host_respects_setting_order()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4);

            var host2 = new HostManifest("h2");
            host2.RegisterSettings(data5);

            host1.Append(host2);

            host1.GetDirective<OneDirective>().Age.ShouldEqual(7);
        }
コード例 #5
0
        public void do_not_bind_complex_child_if_no_data_exists()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                       .With("ComplexDirective.One.Name", "Thurgood")
                       .With("ComplexDirective.One.Age", "57");

            host.RegisterSettings(data);

            var complex = host.GetDirective <ComplexDirective>();

            complex.One.ShouldNotBeNull();
            complex.Two.ShouldBeNull();
        }
コード例 #6
0
        public void append_host_respects_setting_order()
        {
            var host1 = new HostManifest("h1");

            host1.RegisterSettings(data4);


            var host2 = new HostManifest("h2");

            host2.RegisterSettings(data5);


            host1.Append(host2);

            host1.GetDirective <OneDirective>().Age.ShouldEqual(7);
        }
コード例 #7
0
        public void respects_ordering_of_setting_data()
        {
            var host1 = new HostManifest("h1");

            host1.RegisterSettings(data4);
            host1.RegisterSettings(data5);

            host1.GetDirective <OneDirective>().Age.ShouldEqual(7);

            var host2 = new HostManifest("h2");

            host2.RegisterSettings(data5);
            host2.RegisterSettings(data4);

            host2.GetDirective <OneDirective>().Age.ShouldEqual(8);
        }
コード例 #8
0
        public void can_pull_complex_settings()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                       .With("ComplexDirective.One.Name", "Thurgood")
                       .With("ComplexDirective.One.Age", "57")
                       .With("ComplexDirective.Two.City", "Joplin");

            host.RegisterSettings(data);

            var complex = host.GetDirective <ComplexDirective>();

            complex.One.Name.ShouldEqual("Thurgood");
            complex.One.Age.ShouldEqual(57);
            complex.Two.City.ShouldEqual("Joplin");
        }
コード例 #9
0
        public void can_pull_complex_settings()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                .With("ComplexDirective.One.Name", "Thurgood")
                .With("ComplexDirective.One.Age", "57")
                .With("ComplexDirective.Two.City", "Joplin");

            host.RegisterSettings(data);

            var complex = host.GetDirective<ComplexDirective>();

            complex.One.Name.ShouldEqual("Thurgood");
            complex.One.Age.ShouldEqual(57);
            complex.Two.City.ShouldEqual("Joplin");
        }
コード例 #10
0
        public void respects_ordering_of_setting_data()
        {
            var host1 = new HostManifest("h1");
            host1.RegisterSettings(data4);
            host1.RegisterSettings(data5);

            host1.GetDirective<OneDirective>().Age.ShouldEqual(7);

            var host2 = new HostManifest("h2");
            host2.RegisterSettings(data5);
            host2.RegisterSettings(data4);

            host2.GetDirective<OneDirective>().Age.ShouldEqual(8);
        }
コード例 #11
0
        public void do_not_bind_complex_child_if_no_data_exists()
        {
            var host = new HostManifest("host1");

            var data = new SettingsData()
                .With("ComplexDirective.One.Name", "Thurgood")
                .With("ComplexDirective.One.Age", "57");

            host.RegisterSettings(data);

            var complex = host.GetDirective<ComplexDirective>();
            complex.One.ShouldNotBeNull();
            complex.Two.ShouldBeNull();
        }
コード例 #12
0
        public void does_not_set_a_property_that_is_not_explicitly_configured()
        {
            var host = new HostManifest("h1");
            host.RegisterSettings(data4);

            // the default value for Name is "somebody"
            host.GetDirective<OneDirective>().Name.ShouldEqual("somebody");
        }
コード例 #13
0
        public void can_pull_setting_class_out_of_request_data()
        {
            var host = new HostManifest("host1");
            host.RegisterSettings(data3);

            var directive = host.GetDirective<TwoDirective>();
            directive.City.ShouldEqual("Austin");
            directive.IsDomestic.ShouldBeTrue();
        }
コード例 #14
0
        public void can_pull_setting_class_out_of_multiple_data_settings_with_no_conflict()
        {
            var host = new HostManifest("host1");
            host.RegisterSettings(data1);
            host.RegisterSettings(data4);

            var directive = host.GetDirective<OneDirective>();
            directive.Name.ShouldEqual("Max");
            directive.Age.ShouldEqual(7);
        }