Esempio n. 1
0
        public void SetUp()
        {
            _project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
            _project.Value.SetOutputPath("");
            _project.Value.SetAssemblyName("someAssembly.dll");
            _bus                   = MockRepository.GenerateMock <IMessageBus>();
            _listGenerator         = MockRepository.GenerateMock <IGenerateBuildList>();
            _configuration         = MockRepository.GenerateMock <IConfiguration>();
            _buildRunner           = MockRepository.GenerateMock <IBuildRunner>();
            _testRunner            = MockRepository.GenerateMock <ITestRunner>();
            _testAssemblyValidator = MockRepository.GenerateMock <IDetermineIfAssemblyShouldBeTested>();
            _optimizer             = MockRepository.GenerateMock <IOptimizeBuildConfiguration>();
            _fs       = MockRepository.GenerateMock <IFileSystemService>();
            _cache    = MockRepository.GenerateMock <ICache>();
            _runCache = MockRepository.GenerateMock <IRunResultCache>();
            _runInfo  = new RunInfo(_project);
            _runInfo.ShouldBuild();
            _runInfo.SetAssembly(_project.Value.AssemblyName);
            _optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            _preProcessor = MockRepository.GenerateMock <IPreProcessTestruns>();
            _preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new PreProcessedTesRuns(null, new RunInfo[] { _runInfo }));
            var preProcessors     = new IPreProcessTestruns[] { _preProcessor };
            var buildPreProcessor = MockRepository.GenerateMock <IPreProcessBuildruns>();

            buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };

            _removedTestLocator = MockRepository.GenerateMock <ILocateRemovedTests>();
            _buildSessionRunner = new BuildSessionRunner(new BuildConfiguration(null), _cache, _bus, _configuration, _buildRunner, buildPreProcessors, _fs, _runCache);
            _consumer           = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildSessionRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator);
        }
        public void SetUp()
        {
            _project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
			_project.Value.SetOutputPath("");
			_project.Value.SetAssemblyName("someAssembly.dll");
            _bus = MockRepository.GenerateMock<IMessageBus>();
            _listGenerator = MockRepository.GenerateMock<IGenerateBuildList>();
            _configuration = MockRepository.GenerateMock<IConfiguration>();
            _buildRunner = MockRepository.GenerateMock<IBuildRunner>();
            _testRunner = MockRepository.GenerateMock<ITestRunner>();
			_testAssemblyValidator = MockRepository.GenerateMock<IDetermineIfAssemblyShouldBeTested>();
			_optimizer = MockRepository.GenerateMock<IOptimizeBuildConfiguration>();
			_runInfo = new RunInfo(_project);
			_runInfo.ShouldBuild();
			_runInfo.SetAssembly(_project.Value.AssemblyName);
			_optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            _preProcessor = MockRepository.GenerateMock<IPreProcessTestruns>();
            _preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var preProcessors = new IPreProcessTestruns[] { _preProcessor };
            var buildPreProcessor = MockRepository.GenerateMock<IPreProcessBuildruns>();
            buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };
            _removedTestLocator = MockRepository.GenerateMock<ILocateRemovedTests>();
            _consumer = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator, buildPreProcessors);
        }
Esempio n. 3
0
        public void Should_run_tests()
        {
            _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly(null)).Return(false);
            _testRunner.Stub(t => t.CanHandleTestFor("")).IgnoreArguments().Return(true);
            _preProcessor.Stub(p => p.PreProcess(null)).IgnoreArguments().Return(new PreProcessedTesRuns(null, new RunInfo[] { new RunInfo(new AutoTest.Core.Caching.Projects.Project("", null)) }));
            var message = new AssemblyChangeMessage();

            message.AddFile(new ChangedFile());
            _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly(null)).IgnoreArguments().Return(true);
            _consumer.Consume(message);
            _testRunner.AssertWasCalled(t => t.RunTests(null, null, null), t => t.IgnoreArguments());
        }