Esempio n. 1
0
        /// <summary>
        /// Used internally to build the fixture model that the Storyteller client
        /// uses to render the screens
        /// </summary>
        /// <param name="conversions"></param>
        /// <returns></returns>
        public virtual FixtureModel Compile(CellHandling conversions)
        {
            GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance).Where(methodFromThis).Where(x => !x.HasAttribute <HiddenAttribute>()).Each(method =>
            {
                var grammarKey = method.GetKey();
                if (_grammars.Has(grammarKey))
                {
                    return;
                }

                var grammar      = GrammarBuilder.BuildGrammar(method, this);
                this[grammarKey] = grammar;
            });

            var grammarModels = new List <GrammarModel>();

            var grammars = _grammars.GetAllKeys().Select(key =>
            {
                var grammar    = _grammars[key];
                var model      = grammar.Compile(this, conversions);
                model.key      = key;
                model.IsHidden = grammar.IsHidden;

                return(model);
            });

            return(new FixtureModel(Key)
            {
                title = Title ?? Key.SplitCamelCase(),
                grammars = grammars.Where(x => !x.IsHidden).ToArray(),
                implementation = GetType().FullName
            });
        }
Esempio n. 2
0
        protected override IEnumerable<Cell> buildCells(CellHandling cellHandling, Fixture fixture)
        {
            _cell = new Cell(cellHandling, _config.CellName, _config.CellType) {output = isOutput};

            yield return _cell;
        }