public void RunAllInCaseInOrder()
        {
            sut = new Runner.Runner(
                OnSetupsFinished,
                OnTestsFinished,
                OnTearDownsFinished,
                () => { },
                () => { });

            sut.AddCase(
                typeof(RunAllInCaseInOrder));

            //  Act.
            sut.Start();

            //  Assert.
            new[] { _setupsRunCounter.Count(), _testsRunCounter.Count(), _tearDownsRunCounter.Count() }.Should()
            .AllBeEquivalentTo(1,
                               because: "Each of Setup, Test and TearDown should only have been run once.");
            _setupsRunCounter.Max().Should()
            .BeLessThan(_testsRunCounter.Min(),
                        because: "Setup should be run before Test.");
            _testsRunCounter.Max().Should()
            .BeLessThan(_tearDownsRunCounter.Min(),
                        because: "Test should be run before TearDown.");
        }
        public void UseCommonSetupAndTearDown()
        {
            runner = new Runner.Runner(
                OnSetupsFinished,
                () => { },
                OnTearDownsFinished,
                OnDependenciesSetupsFinished,
                OnDependenciesTearDownsFinished);

            runner.AddCase(
                typeof(UseCommonSetupAndTearDownOne));
            runner.AddCase(
                typeof(UseCommonSetupAndTearDownTwo));

            //  Act.
            runner.Start();

            //  Assert.
            new[] { _dependenciesSetupsCounters.Count(), _dependenciesTearDownsCounters.Count() }.Should()
            .AllBeEquivalentTo(1,
                               because: "There should be just one call to each of the dependencies setups and teardowns.");
            _dependenciesSetupsCounters.Max().Should()
            .BeLessThan(_dependenciesTearDownsCounters.Min(),
                        because: "All dependency Setups should be run before teh dependency Teardowns.");

            _dependenciesSetupsCounters.Max().Should()
            .BeLessThan(_testSetupsCounters.Min(),
                        because: "All dependency setups must be run before all test setups.");
            _testTearDownsCounters.Max().Should()
            .BeLessThan(_dependenciesTearDownsCounters.Min(),
                        because: "All tests must have been teared down before all dependency teardowns.");
        }
예제 #3
0
        public void Test1()
        {
            var runner = new Runner.Runner(
                () => { },
                () => { },
                () => { },
                () => { },
                () => { });

            runner.AddCase(typeof(CanLoad));

            runner.Start();
        }