コード例 #1
0
        public void ShouldExecute()
        {
            string pathToExe = "mstest.exe";

            _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.PathToConsoleRunner(pathToExe).InternalExecute();

            _mockExecutable.AssertWasCalled(x => x.Execute());
        }
コード例 #2
0
        public void InternalExecute_ShouldRunNuGetAsExpected()
        {
            _mockFileHelper.Stub(x => x.Find("nuget.exe")).Return(@"c:\temp");
            _mockFileHelper.Stub(x => x.CreateFile("")).IgnoreArguments().Return(new MemoryStream());

            _mockExe.Stub(x => x.ExecutablePath(@"c:\temp")).Return(_mockExe).Repeat.Any();
            _mockExe.Stub(x => x.UseArgumentBuilder(null)).IgnoreArguments().Return(_mockExe).Repeat.Any();
            _mockExe.Stub(x => x.InWorkingDirectory(_subject._deployFolder)).Return(_mockExe).Repeat.Any();


            _subject.InternalExecute();
            //_mockExe.AssertWasCalled(x => x.WithArguments("Update -self"));
            //_mockExe.AssertWasCalled(x => x.WithArguments("setApiKey " + _subject._apiKey));
            //_mockExe.AssertWasCalled(x => x.WithArguments("Pack " + _subject._projectId + ".nuspec"));
            //_mockExe.AssertWasCalled(x => x.WithArguments("Push " + _subject._projectId + "." + _subject._version + ".nupkg"));
            _mockExe.AssertWasCalled(x => x.Execute(), y => y.Repeat.Times(4));
        }