예제 #1
0
        public void PathToConsoleRunner_ShouldPopulateInternalFieldAndReturnSelf()
        {
            var         subject     = new NUnitRunner();
            string      file        = "c:\\temp\\nunit-console.exe";
            NUnitRunner nUnitRunner = subject.PathToNunitConsoleRunner(file);

            Assert.That(nUnitRunner, Is.SameAs(subject));
            Assert.That(nUnitRunner._pathToConsoleRunner, Is.EqualTo(file));
        }
예제 #2
0
        public void Execute_ShouldSetOnErrorStateToFalse()
        {
            string pathToExe      = "c:\\test.exe";
            var    mockExecutable = MockRepository.GenerateStub <IExecutable>();
            var    mockFileFinder = MockRepository.GenerateStub <IFileSystemHelper>();
            var    subject        = new NUnitRunner(mockExecutable, mockFileFinder);

            mockExecutable.Stub(x => x.ExecutablePath(pathToExe)).Return(mockExecutable);
            mockExecutable.Stub(x => x.UseArgumentBuilder(null)).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.SucceedOnNonZeroErrorCodes()).IgnoreArguments().Return(mockExecutable);

            mockExecutable.Stub(x => x.FailOnError).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.ContinueOnError).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.WithMessageProcessor(Arg <IMessageProcessor> .Is.Anything)).Return(mockExecutable);

            subject.PathToNunitConsoleRunner(pathToExe).ContinueOnError.Execute();

            Assert.That(subject.OnError, Is.EqualTo(OnError.Continue));
        }
예제 #3
0
        public void Execute_ShouldSetWorkingDirectoryOnMockIfManuallySpecifiedInCode()
        {
            string workingDirectory = "c:\\temp";
            string pathToExe        = "c:\\test.exe";
            var    mockExecutable   = MockRepository.GenerateStub <IExecutable>();
            var    mockFileFinder   = MockRepository.GenerateStub <IFileSystemHelper>();
            var    subject          = new NUnitRunner(mockExecutable, mockFileFinder);

            mockExecutable.Stub(x => x.ExecutablePath(pathToExe)).Return(mockExecutable);
            mockExecutable.Stub(x => x.UseArgumentBuilder(null)).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.SucceedOnNonZeroErrorCodes()).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.InWorkingDirectory(workingDirectory)).Return(mockExecutable);
            mockExecutable.Stub(x => x.FailOnError).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.ContinueOnError).IgnoreArguments().Return(mockExecutable);
            mockExecutable.Stub(x => x.WithMessageProcessor(Arg <IMessageProcessor> .Is.Anything)).Return(mockExecutable);

            subject.PathToNunitConsoleRunner(pathToExe).WorkingDirectory(workingDirectory).Execute();

            mockExecutable.AssertWasCalled(x => x.InWorkingDirectory(workingDirectory));
        }