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(); }
public async Task <IExecutionResult> HandleAsync(TestUpdateCommand command) { var ar = await GetAggregateAsync <TestRoot, TestState>(command.AggregateRootId); var result = ar.Update(command); var processedEvents = await Store.SaveAsync(ar); await Task.WhenAll(processedEvents.Select(Bus.PublishAsync)); return(await Task.FromResult(result)); }
/// <summary> /// Update. /// </summary> /// <param name="command">TestUpdateCommand.</param> /// <returns>Execution Result.</returns> public IExecutionResult Update(TestUpdateCommand command) { if (command.TestData.Length < 10) { return(ValidationFailed(CoreErrorCodes.ValidationFailed, "Text is too small.")); } PublishEvent(new TestUpdatedEvent { TestData = command.TestData, }); return(Success()); }
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) )); }