public static HtmlDocument Build(Suite top, FixtureLibrary fixtures, string title)
        {
            var document = new HtmlDocument
            {
                Title = title
            };

            document.Head.Append(BatchResultsWriter.StyleTag());

            writeInitialData(document, top, fixtures, title);

#if DEBUG
            var scriptTag = HomeEndpoint.ScriptTag(false, "/preview.js");
            document.Body.Append(scriptTag);
#else
            writeEnbeddedJavascript(document);
#endif

            document.Body.Add("div").Id("main");

            return(document);
        }
示例#2
0
        private SystemRecycled tryToStart()
        {
            CellHandling cellHandling = null;

            try
            {
                cellHandling = _system.Start();
            }
            catch (Exception ex)
            {
                ConsoleWriter.Write(ConsoleColor.Red, ex.ToString());

                var message = new SystemRecycled
                {
                    success          = false,
                    fixtures         = new FixtureModel[0],
                    system_name      = _system.ToString(),
                    system_full_name = _system.GetType().FullName,
                    name             = Path.GetFileName(AppContext.BaseDirectory),
                    error            = ex.ToString()
                };

                return(message);
            }


            var library = FixtureLibrary.CreateForAppDomain(cellHandling);

            startTheConsumingQueues(library);

            return(new SystemRecycled
            {
                success = true,
                fixtures = library.Models.GetAll().ToArray(),
                system_name = _system.ToString(),
                name = Path.GetFileName(AppContext.BaseDirectory)
            });
        }
        public void CreatePlan(FixtureLibrary library)
        {
            var culture = Project.CurrentProject?.Culture;

            if (culture.IsNotEmpty())
            {
#if NET46
                Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
#else
                CultureInfo.CurrentCulture = new CultureInfo(culture);
#endif
            }

            try
            {
                Plan = Specification.CreatePlan(library);
            }
            catch (Exception e)
            {
                Cancel();
                EventAggregator.SendMessage(new PassthroughMessage(new RuntimeError(e)));
            }
        }
        static TestingContext()
        {
            _library = new Lazy <FixtureLibrary>(() =>
            {
                try
                {
                    var fixture = new SentenceFixture();
                    var library = FixtureLibrary.CreateForAppDomain(new GrammarSystem().Start());

                    // Need to force it to use this one instead of the FactFixture in the samples project
                    var factFixture          = new StoryTeller.Testing.EndToEndExecution.FactFixture();
                    library.Models["Fact"]   = factFixture.Compile(CellHandling.Basic());
                    library.Fixtures["Fact"] = factFixture;

                    return(library);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                    throw;
                }
            });
        }
示例#5
0
        private IEnumerable <IExecutionStep> determineSteps(Step step, FixtureLibrary library)
        {
            var section     = step.Collections[_leafName];
            var sectionPlan = section.CreatePlan(library, _fixture);

            if (_before != null)
            {
                yield return(new SilentAction("Grammar", Stage.before, _before, section)
                {
                    Subject = Key + ":Before"
                });
            }

            yield return(sectionPlan);

            if (_after != null)
            {
                yield return(new SilentAction("Grammar", Stage.after, _after, section)
                {
                    Subject = Key + ":After"
                });
            }
        }
        public void SetUp()
        {
            container      = new Container();
            view           = new StubExplorerView();
            shellConductor = MockRepository.GenerateMock <IScreenConductor>();

            explorer = new FixtureExplorer(view, container);


            library = new FixtureLibrary();
            FixtureGraph fixture1 = library.FixtureFor("Math");

            fixture1.AddStructure("Grammar1", new Sentence());
            fixture1.AddStructure("Grammar2", new Sentence());
            fixture1.AddStructure("Grammar3", new Sentence());

            FixtureGraph fixture2 = library.FixtureFor("Arithmetic");

            fixture2.AddStructure("Grammar4", new Sentence());
            fixture2.AddStructure("Grammar5", new Sentence());

            explorer.Handle(new BinaryRecycleFinished(library));
        }
示例#7
0
 public void SetUp()
 {
     baseLibrary = FixtureLibrary.For(x => x.AddFixturesFromAssemblyContaining <MathFixture>());
     library     = baseLibrary.Filter(f => f.Name == "Sentence" || f.Name == "Sets");
 }
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
 {
     return(new CompositeExecution(toExecutionSteps(library, step)));
 }
示例#9
0
        public void build_for_fixture_that_blows_up()
        {
            var compiled = FixtureLibrary.CreateCompiledFixture(CellHandling.Basic(), typeof(FixtureThatBlowsUp));

            compiled.Model.implementation.ShouldBe(typeof(FixtureThatBlowsUp).FullName);
        }
示例#10
0
        public SpecRunner()
        {
            _system = new T();

            _library = FixtureLibrary.CreateForAppDomain(_system.Start());
        }
示例#11
0
 public void RecordSystemFixtures(SystemRecycled recycled)
 {
     _systemFixtures = FixtureLibrary.From(recycled.fixtures);
 }
示例#12
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library)
 {
     return(new CompositeExecution(determineSteps(step, library).ToArray()));
 }
示例#13
0
 public string ToPreview(FixtureLibrary library, Test test)
 {
     return(new HtmlWriter(library).WritePreview(test).ToString());
 }
示例#14
0
 public BinaryRecycleFinished(FixtureLibrary library)
 {
     _library = library;
 }
示例#15
0
 public void Handle(BinaryRecycleFinished message)
 {
     _library = message.Library;
 }
示例#16
0
 public TestRunner(SystemLifecycle lifecycle, FixtureLibrary library, IFixtureContainerSource source)
 {
     _lifecycle = lifecycle;
     _library   = library;
     _source    = source;
 }
示例#17
0
 public TestRunner(ISystem system, FixtureLibrary library, IFixtureContainerSource source)
     : this(new SystemLifecycle(system), library, source)
 {
 }
示例#18
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library)
 {
     throw new NotImplementedException();
 }
示例#19
0
 public IEnumerable <IStartupActionSelector> GetActionSelectors(FixtureLibrary library, WorkspaceFilter filter)
 {
     return(library.StartupActions.Select(x => new StartupActionSelector(x, filter.StartupActions.Contains(x))).ToArray());
 }
示例#20
0
 public GrammarStructure ToStructure(FixtureLibrary library)
 {
     return(new DoGrammarStructure());
 }
        public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
        {
            var stepValues = _invocation.InputCells().ToStepValues(step);

            return(new FactCheckPlan(stepValues, this));
        }
示例#22
0
        static TestingContext()
        {
            var fixture = new StoryTeller.Samples.Fixtures.SentenceFixture();

            Library = FixtureLibrary.CreateForAppDomain(new GrammarSystem().Start());
        }
示例#23
0
 IExecutionStep IGrammar.CreatePlan(Step step, FixtureLibrary library, bool inTable)
 {
     return new FactPlan(new StepValues(step.id), this);
 }
示例#24
0
 public void RecordSystemFixtures(FixtureLibrary system)
 {
     _systemFixtures = system;
 }
        public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
        {
            var innerPlan = _inner.CreatePlan(step, library);

            return(new ImportedExecutionStep(_innerFixture, innerPlan));
        }
示例#26
0
 public GrammarStructure ToStructure(FixtureLibrary library)
 {
     throw new NotImplementedException();
 }
示例#27
0
 public HtmlWriter(FixtureLibrary library)
 {
     _library = library;
 }
示例#28
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library)
 {
     return(_inner.CreatePlan(step, library));
 }
示例#29
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
 {
     return(_inner.CreatePlan(step, library));
 }
示例#30
0
 public IExecutionStep CreatePlan(Step step, FixtureLibrary library, bool inTable = false)
 {
     _defaults.Each(pair => step.Values[pair.Key] = pair.Value);
     return(_inner.CreatePlan(step, library));
 }