Beispiel #1
0
        public void adds_a_warm_up_policy_for_asset_combinations()
        {
            var registry = new FubuRegistry();

            registry.Assets().CombineAllUniqueAssetRequests();

            BehaviorGraph.BuildFrom(registry).Services.ServicesFor <IAssetPolicy>()
            .ShouldContain(x => x.Type == typeof(WarmUpSetsForCombinationPolicy));
        }
Beispiel #2
0
        public void apply_the_simplistic_asset_combination_approach()
        {
            var registry = new FubuRegistry();

            registry.Assets().CombineAllUniqueAssetRequests();

            BehaviorGraph.BuildFrom(registry).Services.DefaultServiceFor <ICombinationDeterminationService>()
            .Type.ShouldEqual(typeof(CombineAllUniqueSetsCombinationDeterminationService));
        }
Beispiel #3
0
        public void register_a_custom_missing_asset_handler()
        {
            var registry = new FubuRegistry();

            registry.Assets().HandleMissingAssetsWith <MyDifferentMissingAssetHandler>();

            BehaviorGraph.BuildFrom(registry).Services.DefaultServiceFor <IMissingAssetHandler>()
            .Type.ShouldEqual(typeof(MyDifferentMissingAssetHandler));
        }
Beispiel #4
0
        public void YSOD_true()
        {
            var registry = new FubuRegistry();

            registry.Assets().YSOD_on_missing_assets(true);

            BehaviorGraph.BuildFrom(registry).Services.DefaultServiceFor <IMissingAssetHandler>()
            .Type.ShouldEqual(typeof(YellowScreenMissingAssetHandler));
        }
Beispiel #5
0
        public void YSOD_false()
        {
            var registry = new FubuRegistry();

            registry.Assets().YSOD_on_missing_assets(false);

            BehaviorGraph.BuildFrom(x => x.Import <AssetBottleRegistration>()).Services.DefaultServiceFor <IMissingAssetHandler>()
            .Type.ShouldEqual(typeof(TraceOnlyMissingAssetHandler));
        }
Beispiel #6
0
        public void register_a_combination_policy_with_CombineWith()
        {
            var registry = new FubuRegistry();

            registry.Assets()
            .CombineWith <CombineAllScriptFiles>()
            .CombineWith <CombineAllStylesheets>();

            BehaviorGraph.BuildFrom(registry).Services.ServicesFor(typeof(ICombinationPolicy))
            .Select(x => x.Type).ShouldHaveTheSameElementsAs(typeof(CombineAllScriptFiles), typeof(CombineAllStylesheets));
        }
Beispiel #7
0
        public void should_register_the_recording_registration_as_a_policy_in_behavior_graph()
        {
            var registry = new FubuRegistry();

            registry.Assets().Asset("a.js").Requires("b.js");

            var graph = BehaviorGraph.BuildFrom(registry);

            var registration = graph.Services.ServicesFor <IAssetPolicy>()
                               .Single().Value.ShouldBeOfType <RecordingAssetRegistration>();

            var inner = MockRepository.GenerateMock <IAssetRegistration>();

            registration.Replay(inner);

            inner.AssertWasCalled(x => x.Dependency("a.js", "b.js"));
        }