Пример #1
0
        public void execute_a_combination_policy()
        {
            var policy = MockFor <ICombinationPolicy>();
            var combos = new AssetFileCombination[] {
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0])
            };



            var thePlan = MockRepository.GenerateMock <AssetTagPlan>(MimeType.Css, new AssetFile[0]);

            // Leaving this in here.  What I found out in the Storyteller testing is that
            // we have to apply the combination policy "go find existing combinations" first
            //combos.Each(combo => thePlan.Expect(x => x.TryCombination(combo)).Return(true));

            policy.Stub(x => x.DetermineCombinations(thePlan)).Return(combos);

            ClassUnderTest.ExecutePolicy(thePlan, policy);

            combos.Each(c => MockFor <IAssetCombinationCache>().AssertWasCalled(x => x.StoreCombination(thePlan.MimeType, c)));

            // All the combos should have been registered
            thePlan.VerifyAllExpectations();
        }
Пример #2
0
        void IContentPlanScenario.CombinationOfStyles(string name, params string[] fileNames)
        {
            _name = name;

            var files = fileNames.Select(fileFor);

            _combination = new StyleFileCombination(name, files);
            _files.AddRange(files);
        }
Пример #3
0
        public void try_all_existing_combinations()
        {
            var combos = new AssetFileCombination[] {
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0]),
                new ScriptFileCombination(new AssetFile[0])
            };

            var thePlan = MockRepository.GenerateMock <AssetTagPlan>(MimeType.Css, new AssetFile[0]);

            MockFor <IAssetCombinationCache>().Stub(x => x.OrderedListOfCombinations(thePlan.MimeType))
            .Return(combos);


            combos.Each(c => thePlan.Expect(x => x.TryCombination(c)).Return(true));

            ClassUnderTest.TryAllExistingCombinations(thePlan);

            // Should try all the existing combinations
            thePlan.VerifyAllExpectations();
        }