public void SetUp()
        {
            ProjectPersistor.DeleteHistoryFile();

            Bootstrapper.ForceRestart();
            var events = new SimpleEventAggregator();

            ObjectFactory.Inject <IEventAggregator>(events);

            var observer = ObjectFactory.GetInstance <UserInterfaceTestObserver>();

            project = DataMother.MathProject();

            project.GetBinaryFolder().ShouldEqual(Path.GetFullPath(@"..\..\..\StoryTeller.Samples\bin\debug"));

            hierarchy = project.LoadTests();

            events.RemoveAllListeners();
            listener = ObjectFactory.GetInstance <StubLibraryListener>();


            engine = ObjectFactory.GetInstance <TestEngine>();


            engine.Handle(new ProjectLoaded(project));

            engine.WaitForProcessing();
        }
 protected override void beforeEach()
 {
     Services.PartialMockTheClassUnderTest();
     MockFor <IFileDialogPicker>().Expect(x => x.ShowDialog()).Return(DialogResult.OK);
     _fileName = "someFileName";
     MockFor <IFileDialogPicker>().Expect(x => x.Selection).Return(_fileName);
     _project = DataMother.MathProject();
     MockFor <IProjectPersistor>().Expect(x => x.LoadFromFile(_fileName)).Return(_project);
     ClassUnderTest.LoadExistingProject();
 }
Exemple #3
0
        public void write_a_test()
        {
            Test test = DataMother.MathProject().LoadTests().GetAllTests().First();
            var  node = new JsonNode("Test");

            var visitor = new WriterVisitor(test, node);

            visitor.Write();

            Debug.WriteLine(node.ToJson());
        }
Exemple #4
0
        public void run_test_through_the_container()
        {
            var  queue = ObjectFactory.GetInstance <IExecutionQueue>().As <ExecutionQueue>();
            Test test  = DataMother.MathProject().LoadTests().Tests[0];

            test.ShouldNotBeNull();

            queue.QueueTest(test);
            listener.Wait5SecondsForCompletion();
            queue.Stop();
        }
        protected sealed override void beforeEach()
        {
            hierarchy = DataMother.MathProject().LoadTests();
            Services.Inject(new ProjectContext()
            {
                Project   = MockFor <IProject>(),
                Hierarchy = hierarchy
            });

            theContextIs();

            ClassUnderTest.HandleMessage(theMessage);
        }
        protected override void beforeEach()
        {
            hierarchy = DataMother.MathProject().LoadTests();

            tests = hierarchy.GetAllTests().ToArray();
            test1 = tests[0];
            test2 = tests[1];
            test3 = tests[2];

            test2.LastResult = new TestResult();
            test3.LastResult = new TestResult();

            results = new ResultHistory();

            results[test1] = new TestResult();
            results[test2] = new TestResult();

            ClassUnderTest.ApplyResults(hierarchy, results);
        }
        public void try_to_write_table()
        {
            Project project = DataMother.MathProject();
            string  xml     =
                @"
<Test name='Bad Add 1'>
  <Math>
    <AddTable>
      <operation>
        <operation x='1' y='2' sum='4' />
        <operation x='2' y='2' sum='5' />
        <operation x='3' y='2' sum='6' />
      </operation>
    </AddTable>

  </Math>
</Test>";

            Test        test   = TestUtility.ReadTest(xml);
            ITestRunner runner = TestRunnerBuilder.ForFixture <MathFixture>();

            runner.RunTest(test);
        }
Exemple #8
0
 public void SetUp()
 {
     project = DataMother.MathProject();
 }
 protected override TreeNode GetTestNode()
 {
     return(new TreeNode(new Hierarchy(DataMother.MathProject())));
 }
 protected override void beforeEach()
 {
     _fileName = "someFileName";
     MockFor <IFileDialogPicker>().Expect(x => x.ShowDialog()).Return(DialogResult.OK);
     MockFor <IProjectPersistor>().Expect(x => x.LoadFromFile(_fileName)).Throw(new Exception("bad exception"));
     MockFor <IFileDialogPicker>().Stub(x => x.Selection).Return(_fileName);
     MockFor <IProjectPersistor>().Stub(x => x.LoadFromFile("someFileName")).Return(DataMother.MathProject());
     ClassUnderTest.LoadExistingProject();
 }
Exemple #11
0
        public void get_file_name_for_test_gets_the_full_path_with_underscores_for_paths()
        {
            var test = DataMother.MathProject().LoadTests().GetAllTests().First();

            ResultPersistor.FileNameFor(test).ShouldEqual(test.GetPath().Locator.Replace("/", ".").Replace(" ", "_") + ".stresult");
        }
Exemple #12
0
 public void SetUp()
 {
     project   = DataMother.MathProject();
     hierarchy = project.LoadTests();
 }