protected override void beforeEach()
        {
            _graph = new AssetGraph();

            _assetsForSetA = new[] { "a-1.js", "a-2.js" };
            _assetsForSetB = new[] { "b-1.css", "b-2.css" };

            _assetsForSetC = new[] { "c-1.js", "c-2.js", "c-3.css", "c-4.css" };

            _assetsForSetA.Each(x => _graph.AddToSet("setA", x));
            _assetsForSetB.Each(x => _graph.AddToSet("setB", x));
            _assetsForSetC.Each(x => _graph.AddToSet("setC", x));

            _graph.CompileDependencies(null);

            MockFor <IAssetDependencyFinder>()
            .Stub(x => x.CompileDependenciesAndOrder(new[] { "setA" }))
            .Return(_assetsForSetA);

            MockFor <IAssetDependencyFinder>()
            .Stub(x => x.CompileDependenciesAndOrder(new[] { "setB" }))
            .Return(_assetsForSetB);

            MockFor <IAssetDependencyFinder>()
            .Stub(x => x.CompileDependenciesAndOrder(new[] { "setC" }))
            .Return(_assetsForSetC);

            ClassUnderTest.Apply(null, null, _graph);
        }
Exemple #2
0
 protected override void beforeEach()
 {
     _log        = MockFor <IPackageLog>();
     _fileSystem = MockFor <IFileSystem>();
     _assetGraph = MockFor <AssetGraph>();
     _fileSystem.Expect(x => x.FindFiles(Arg <string> .Is.Anything, Arg <FileSet> .Is.Anything))
     .Return(new string[] { });
 }
Exemple #3
0
 public IGrammar SetupScriptGraph()
 {
     return(Embed <ScriptGraphSetupFixture>("If the script graph is configured as")
            .Before((step, context) =>
     {
         _graph = new AssetGraph();
         context.Store(_graph);
     }));
 }
        public void apply_policy_type_integrated_with_asset_graph()
        {
            var graph  = new AssetGraph();
            var reader = new AssetDslReader(graph);

            reader.ReadLine("apply policy " + typeof(AssetGraphTester.FakeComboPolicy).AssemblyQualifiedName);

            graph.PolicyTypes.ShouldHaveTheSameElementsAs(typeof(AssetGraphTester.FakeComboPolicy));
        }
        public void SetUp()
        {
            Directory.GetFiles(".", "*.script.config").Each(x => File.Delete(x));


            assets    = new AssetGraph();
            activator = new AssetGraphConfigurationActivator(assets, new FileSystem(), new AssetLogsCache());

            log = new PackageLog();
        }
        protected override void beforeEach()
        {
            var assetGraph = new AssetGraph();

            assetGraph.Dependency("a.js", "b.js");
            assetGraph.Dependency("a.js", "c.js");
            assetGraph.Dependency("d.js", "e.js");
            assetGraph.Dependency("d.js", "b.js");
            assetGraph.CompileDependencies(new PackageLog());
            Services.Inject <IAssetDependencyFinder>(new AssetDependencyFinderCache(assetGraph));
        }
Exemple #7
0
 protected override void beforeEach()
 {
     _assetGraph     = MockFor <AssetGraph>();
     _precompiler    = MockFor <IAssetPrecompiler>();
     _assetFileGraph = MockFor <IAssetFileGraph>();
     _precompiler
     .Expect(x => x.Precompile(Arg <IAssetFileGraph> .Is.Same(_assetFileGraph), Arg <IAssetRegistration> .Is.Same(_assetGraph)))
     .Callback <IAssetFileGraph, IAssetRegistration>((x, y) => _result = true);
     _log = MockFor <IPackageLog>();
     Services.Inject <IEnumerable <IAssetPrecompiler> >(new[] { _precompiler });
 }
        protected override void beforeEach()
        {
            theContainer = new Container();
            Services.Inject <IContainerFacility>(new StructureMapContainerFacility(theContainer));

            theGraph = new AssetGraph();
            Services.Inject(theGraph);

            theContextIs();

            ClassUnderTest.Activate(new IPackageInfo[0], MockFor <IPackageLog>());
        }
        protected override void beforeEach()
        {
            theContainer = new Container(x => {
                x.ForSingletonOf <ICombinationPolicyCache>().Use <CombinationPolicyCache>();
            });

            theGraph = new AssetGraph();
            Services.Inject(theGraph);

            theContextIs();

            ClassUnderTest.Activate(new IPackageInfo[0], MockFor <IPackageLog>());
        }
Exemple #10
0
        public void using_the_configure_method()
        {
            var graph      = new AssetGraph();
            var expression = new AssetsExpression(theRegistry, graph);

            expression.Configure(@"
crud includes a.js, b.js, c.js
");

            graph.CompileDependencies(new PackageLog());

            graph.AssetSetFor("crud").AllFileDependencies()
            .Select(x => x.Name)
            .ShouldHaveTheSameElementsAs("a.js", "b.js", "c.js");
        }
Exemple #11
0
        public void SetUp()
        {
            graph = new AssetGraph();
            var reader = new AssetDslReader(graph);

            reader.ReadLine("1 includes A,B,C");
            reader.ReadLine("2 includes C,D");
            reader.ReadLine("3 includes 1,E");
            reader.ReadLine("D requires D1,D2");
            reader.ReadLine("3 requires 4");
            reader.ReadLine("4 includes jquery,validation.js");
            reader.ReadLine("Combo includes 1,2");
            reader.ReadLine("C-1 extends C");
            reader.ReadLine("crud includes crudForm.js,validation.js");
            reader.ReadLine("A requires crud");
            graph.CompileDependencies(new PackageLog());
        }
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // load configuration and build asset graph
            this.assetGraph =
                AssetGraph.BuildAssetGraph(
                    helper.ReadJsonFile <StardewHazeConfig>("config/stardewhaze.json")
                    ?? new StardewHazeConfig());

            // attach asset injectors
            helper.Content.AssetEditors.Add(new CropInjector(helper, this.Monitor, this.assetGraph));
            helper.Content.AssetEditors.Add(new CropTileSheetInjector(helper, this.Monitor, this.assetGraph));
            helper.Content.AssetEditors.Add(new ObjectInjector(helper, this.Monitor, this.assetGraph));
            helper.Content.AssetEditors.Add(new ObjectTileSheetInjector(helper, this.Monitor, this.assetGraph));
            helper.Content.AssetEditors.Add(new CraftableInjector(helper, this.Monitor, this.assetGraph));

            SaveEvents.AfterLoad += this.AddRecipe;
        }
        public void find_dependencies()
        {
            var graph = AssetGraph.Build(x =>
            {
                x.Dependency("a.js", "a-dep1.js");
                x.Dependency("a.js", "a-dep2.js");
                x.Dependency("b.js", "c.js");
            });

            var cache = new AssetDependencyFinderCache(graph);

            cache.CompileDependenciesAndOrder(new string[] { "b.js", "a.js" })
            .ShouldHaveTheSameElementsAs("a-dep1.js", "a-dep2.js", "c.js", "a.js", "b.js");

            cache.CompileDependenciesAndOrder(new string[] { "b.js", "a.js" })
            .ShouldHaveTheSameElementsAs("a-dep1.js", "a-dep2.js", "c.js", "a.js", "b.js");
        }
        protected override void beforeEach()
        {
            theGraph = new AssetGraph();
            Services.Inject(theGraph);

            theCache = new AssetCombinationCache();
            Services.Inject <IAssetCombinationCache>(theCache);

            Services.Inject <IAssetFileGraph>(new StubAssetFileGraph());

            theGraph.AddToCombination("combo1", "a.js");
            theGraph.AddToCombination("combo1", "b.js");
            theGraph.AddToCombination("combo1", "c.js");

            theGraph.AddToCombination("combo2", "a.js");
            theGraph.AddToCombination("combo2", "b.js");

            ClassUnderTest.Activate(new IPackageInfo[0], MockFor <IPackageLog>());
        }
 public void Apply(IPackageLog log, IAssetPipeline pipeline, AssetGraph graph)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ObjectInjector"/> class.
 /// </summary>
 /// <param name="helper">
 ///     An <see cref="IModHelper"/> to access the game context.
 /// </param>
 /// <param name="monitor">
 ///     A reference to the <see cref="IMonitor"/> for debugging purposes.
 /// </param>
 /// <param name="assetGraph">
 ///     The <see cref="AssetGraph"/> containing all object data and indices.
 /// </param>
 public ObjectInjector(IModHelper helper, IMonitor monitor, AssetGraph assetGraph)
 {
     this.monitor    = monitor;
     this.helper     = helper;
     this.assetGraph = assetGraph;
 }
Exemple #17
0
 public RecordingCombinationDeterminationService(AssetGraph graph, IAssetCombinationCache cache, IEnumerable <ICombinationPolicy> policies) : base(cache, policies)
 {
 }
Exemple #18
0
 public void SetUp()
 {
     theGraph = new AssetGraph();
 }
Exemple #19
0
 public ScriptGraphFixture()
 {
     _graph = new AssetGraph();
 }
Exemple #20
0
 public override void SetUp(ITestContext context)
 {
     _graph = context.Retrieve <AssetGraph>();
 }
 public void Apply(IPackageLog log, IAssetFileGraph fileGraph, AssetGraph graph)
 {
     throw new NotImplementedException();
 }
Exemple #22
0
 public void SetUp()
 {
     _compiled = false;
     theGraph  = new AssetGraph();
 }
Exemple #23
0
 public ScriptWriter(AssetGraph assets, IUrlRegistry urls)
 {
     _assets = assets;
     _urls   = urls;
 }
Exemple #24
0
 public AssetsEndpoint(AssetGraph graph, AssetLogsCache assetLogs)
 {
     _graph     = graph;
     _assetLogs = assetLogs;
 }