internal void Should_not_update_when_version_has_not_changed( Build build, TestUpdateCommand command) { command.Client.Builds.LastSuccessfulBuildFromConfig(Arg.Any <string>()).Returns(Task.FromResult(build)); command.AssemblyMetada.FileVersion.Returns(build.Number); command.Execute(null).Wait(); }
internal void Should_move_exe_to_old_file( Build build, string newFileVersion, TestUpdateCommand command) { const string exePath = @"Z:\blah\TeamCityConsole.exe"; const string oldExePath = exePath + ".old"; command.Client.Builds.LastSuccessfulBuildFromConfig(Arg.Any <string>()).Returns(Task.FromResult(build)); command.AssemblyMetada.FileVersion.Returns(newFileVersion); command.AssemblyMetada.Location.Returns(exePath); command.Execute(null).Wait(); command.FileSystem.Received().MoveFile(exePath, oldExePath); }
internal void Should_download_new_exe( Build build, string newFileVersion, TestUpdateCommand command) { const string exePath = @"Z:\blah\TeamCityConsole.exe"; command.Client.Builds.LastSuccessfulBuildFromConfig(Arg.Any <string>()).Returns(Task.FromResult(build)); command.AssemblyMetada.FileVersion.Returns(newFileVersion); command.AssemblyMetada.Location.Returns(exePath); command.Execute(null).Wait(); command.Downloader.Received().Download(@"Z:\blah", Arg.Is <File>(file => file.Name == "TeamCityConsole.exe" && file.ContentHref == string.Format("repository/download/{0}/{1}:id/TeamCityApi.zip!/TeamCityConsole.exe", command.Settings.SelfUpdateBuildConfigId, build.Id) )); }