public async Task InvokeFunction()
        {
            var root   = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../../");
            var config = Hypar.Model.Function.FromJson(File.ReadAllText(Path.Combine(root, "hypar.json")));

            var store = new FileModelStore <ProgramByCSVInputs>(root);

            // Create an input object with default values.
            var input = new ProgramByCSVInputs();

            // Read local input files to populate incoming test data.
            if (config.ModelDependencies != null)
            {
                var modelInputKeys = new Dictionary <string, string>();
                foreach (var dep in config.ModelDependencies)
                {
                    modelInputKeys.Add(dep.Name, $"{dep.Name}.json");
                }
                input.ModelInputKeys = modelInputKeys;
            }

            // Invoke the function.
            // The function invocation uses a FileModelStore
            // which will write the resulting model to disk.
            // You'll find the model at "./model.gltf"
            var l = new InvocationWrapper <ProgramByCSVInputs, ProgramByCSVOutputs>(store, ProgramByCSV.Execute);
            await l.InvokeAsync(input);
        }
示例#2
0
        public void ProgramByCSVTest_School()
        {
            var inputs =
                new ProgramByCSVInputs(
                    new Hypar.Functions.Execution.InputData(INPUT + "School.csv"),
                    useImperialUnits: false,
                    suiteSequence: ProgramByCSVInputsSuiteSequence.Listed,
                    roomSequence: ProgramByCSVInputsRoomSequence.Listed,
                    "", "", new Dictionary <string, string>(), "", "", "");
            var outputs =
                ProgramByCSV.Execute(new Dictionary <string, Model> {
                { "Program", new Model() }
            }, inputs);

            System.IO.File.WriteAllText(OUTPUT + "ProgramByCSV_School.json", outputs.Model.ToJson());
        }