public async Task <IIssue> SaveIssue(IIssue issue) { var current = issue.IsPersisted() ? await GetIssueInternal(issue.Id.Value).ConfigureAwait(false) : new DataAccess.Contracts.Issue() { Id = await keyGenerator().ConfigureAwait(false) }; var translated = translator.ToModel(issue); current.Title = translated.Title; current.Description = translated.Description; current.Estimate = translated.Estimate; // Capture the history of states current.Type = translated.Type; current.Statuses.Add(translated.Type); //if ((current.Type & translated.Type) != translated.Type) //{ // current.Type |= translated.Type; //} issues.AddOrUpdate(current.Id.Value, current, (id, existing) => current); return(issue); }
/// <summary> /// Returns the level of the issue. /// </summary> /// <param name="issue">Issue for which the level should be returned.</param> /// <returns>Level of the issue.</returns> public static FailureLevel Level(this IIssue issue) { issue.NotNull(nameof(issue)); if (!issue.Priority.HasValue) { return(FailureLevel.None); } switch (issue.Priority) { case (int)IssuePriority.Suggestion: case (int)IssuePriority.Hint: return(FailureLevel.Note); case (int)IssuePriority.Warning: return(FailureLevel.Warning); case (int)IssuePriority.Error: return(FailureLevel.Error); default: return(FailureLevel.None); } }
/// <summary> /// Converts an <see cref="IIssue"/> to a <see cref="SerializableIssueV4"/>. /// </summary> /// <param name="issue">Issue which should be converted.</param> /// <returns>Converted issue.</returns> internal static SerializableIssueV4 ToSerializableIssue(this IIssue issue) { issue.NotNull(nameof(issue)); return(new SerializableIssueV4 { Identifier = issue.Identifier, ProjectFileRelativePath = issue.ProjectFileRelativePath?.FullPath, ProjectName = issue.ProjectName, AffectedFileRelativePath = issue.AffectedFileRelativePath?.FullPath, Line = issue.Line, EndLine = issue.EndLine, Column = issue.Column, EndColumn = issue.EndColumn, FileLink = issue.FileLink?.ToString(), MessageText = issue.MessageText, MessageMarkdown = issue.MessageMarkdown, MessageHtml = issue.MessageHtml, Priority = issue.Priority, PriorityName = issue.PriorityName, Rule = issue.Rule, RuleUrl = issue.RuleUrl?.ToString(), Run = issue.Run, ProviderType = issue.ProviderType, ProviderName = issue.ProviderName, AdditionalInformation = issue.AdditionalInformation.ToDictionary(p => p.Key, p => p.Value), }); }
private void Render(IIssue issue) { using (Tag("h3")) Write(issue.Title); Write(issue.Message); if (issue is DeadLockIssue dlk) { using (Tag("h4")) Write("Deadlock cycle"); RenderTable( dlk.Cycle.Zip(dlk.StackTraces, (c, s) => (c, s)), ("Thread id", e => Write(e.Item1.Item1.ManagedThreadId.ToString())), ("Stack trace", e => RenderStackTrace(e.Item2))); } else if (issue is UnhandledExceptionIssue ex) { using (Tag("h4")) Write("Exception type"); Write(ex.ExceptionType); using (Tag("h4")) Write("Exception message"); using (new DetailsTag(Writer)) Write(ex.ExceptionMessage); using (Tag("h4")) Write("Stack trace"); RenderStackTrace(ex.StackTrace); } }
/// <summary> /// Returns the line range in the format <c>{Line}:{Column}-{EndLine}:{EndColumn}</c>. /// </summary> /// <param name="issue">Issue for which the line range should be returned.</param> /// <param name="addColumn">Flag if column information should also be returned.</param> /// <returns>Line and column range.</returns> public static string LineRange(this IIssue issue, bool addColumn) { issue.NotNull(nameof(issue)); string result = string.Empty; if (issue.Line.HasValue) { result += issue.Line.ToString(); if (addColumn && issue.Column.HasValue) { result += $":{issue.Column.Value}"; } if (issue.EndLine.HasValue) { result += $"-{issue.EndLine.Value}"; if (addColumn && issue.EndColumn.HasValue) { result += $":{issue.EndColumn.Value}"; } } } return(result); }
public void Should_Throw_If_Issue_Is_Null() { // Given var fixture = new IssueCheckerFixture(); IIssue issue = null; // When var result = Record.Exception(() => IssueChecker.Check( issue, fixture.ProviderType, fixture.ProviderName, fixture.ProjectFileRelativePath, fixture.ProjectName, fixture.AffectedFileRelativePath, fixture.Line, fixture.Message, fixture.Priority, fixture.PriorityName, fixture.Rule, fixture.RuleUrl)); // Then result.IsArgumentNullException("issue"); }
public void ThenTheCommentIsRemoved() { IIssue savedIssue = GetSavedIssue(); IEnumerable <IComment> comments = savedIssue.Comments; Assert.That(comments, Is.Empty); }
public void WhenIGetTheAttachmentsOfTheIssue() { IIssue issue = GetSavedIssue(); IEnumerable <IAttachment> attachments = StepHelper.GetAttachments(GetSavedIssue()); ScenarioContext.Current.Set(attachments); }
/// <summary> /// Checks values of an issue. /// </summary> /// <param name="issueToCheck">Issue which should be checked.</param> /// <param name="expectedIssue">Description of the expected issue.</param> public static void Check( IIssue issueToCheck, IIssue expectedIssue) { issueToCheck.NotNull(nameof(issueToCheck)); expectedIssue.NotNull(nameof(expectedIssue)); Check( issueToCheck, expectedIssue.ProviderType, expectedIssue.ProviderName, expectedIssue.Run, expectedIssue.Identifier, expectedIssue.ProjectFileRelativePath?.ToString(), expectedIssue.ProjectName, expectedIssue.AffectedFileRelativePath?.ToString(), expectedIssue.Line, expectedIssue.EndLine, expectedIssue.Column, expectedIssue.EndColumn, expectedIssue.FileLink, expectedIssue.MessageText, expectedIssue.MessageHtml, expectedIssue.MessageMarkdown, expectedIssue.Priority, expectedIssue.PriorityName, expectedIssue.Rule, expectedIssue.RuleUrl, expectedIssue.AdditionalInformation); }
private string GetFileLinkPattern( IIssue issue, IDictionary <string, string> values, string versionType, string version) { issue.NotNull(nameof(issue)); values.NotNull(nameof(values)); versionType.NotNullOrWhiteSpace(nameof(versionType)); version.NotNullOrWhiteSpace(nameof(version)); var result = this.repositoryUrl.ToString().TrimEnd('/') + "?path=/" + values.GetValueOrDefault("rootPath", null)?.TrimStart('/').WithEnding("/") + "{FilePath}" + "&version=" + versionType + version; if (issue.Line.HasValue) { result += "&line={Line}" + "&lineEnd=" + (issue.EndLine.HasValue ? "{EndLine}" : "{Line}") + "&lineStartColumn=" + (issue.Column.HasValue ? "{Column}" : "1") + "&lineEndColumn=" + (issue.EndColumn.HasValue ? "{EndColumn}" : int.MaxValue.ToString()); } return(result); }
public void AttachFile(IIssue issue, string filePath) { Console.WriteLine("Attaching file {0} for Issue with Id: {1}", filePath, issue.Id); issue.AttachFile(filePath); }
public void ThenTheSubsystemIsChanged() { IIssue savedIssue = GetSavedIssue(); IIssue issue = StepHelper.GetIssue(savedIssue.Id); Assert.That(issue.Subsystem, Is.EqualTo(Subsystem)); }
public void ThenTheTypeIsChanged() { IIssue savedIssue = GetSavedIssue(); IIssue issue = StepHelper.GetIssue(savedIssue.Id); Assert.That(issue.Type, Is.EqualTo(IssueType)); }
public IIssue CreateIssue(string project, string summary, string description) { IIssue issue = GetIssueRepository().CreateIssue(project, summary, description, "Automated Testers"); Console.WriteLine("Issue created with Id: {0}", issue.Id); return(issue); }
public IssueController(IIssuServices IssueService, IStudentServices studentService, IBookService bookservices, IIssue Issuemodel) { _Issue = new Issue(); _IIssuServices = IssueService; _IStudentServices = studentService; _IBookService = bookservices; _IIssue = Issuemodel; }
void AddBadWriteLocation(string path, IIssue i) { badWriteLocations.Add(path); if (i != null) { sink.AcceptIssue(i); } }
/// <summary> /// Checks if file path from an <see cref="IIssue"/> and <see cref="IPullRequestDiscussionThread"/> /// are matching. /// </summary> /// <param name="issue">Issue to check.</param> /// <param name="thread">Comment thread to check.</param> /// <returns><c>true</c> if both paths are matching or if both paths are set to <c>null</c>.</returns> private static bool FilePathsAreMatching(IIssue issue, IPullRequestDiscussionThread thread) { return ((issue.AffectedFileRelativePath == null && thread.AffectedFileRelativePath == null) || ( issue.AffectedFileRelativePath != null && thread.AffectedFileRelativePath != null && thread.AffectedFileRelativePath.ToString() == issue.AffectedFileRelativePath.ToString())); }
public void RemoveCommentForIssue(IIssue issue) { IEnumerable <IComment> comments = issue.Comments; string commentId = comments.Single().Id; Console.WriteLine("Removing comment {0} for Issue with Id: {1}", commentId, issue.Id); issue.RemoveComment(commentId); }
private static void OrderIssueProcessing(IIssue issue) { for (var i = 0u; i < OrderIssueAnswerNumber; i++) { issue.Answers.Add(new Answer { OrderNo = i }); } }
protected bool Deactivate(IIssue entity) { // Deactivate it IssuesRepository.Deactivate(entity); // Try to Save Changes IssuesRepository.SaveChanges(); // Finished! return(true); }
/// <summary> /// Adds an issue to the data class. /// </summary> /// <param name="issue">Issue which should be added.</param> public void AddIssue(IIssue issue) { if (issue == null) { throw new ArgumentNullException(nameof(issue)); } this.issues.Add(issue); }
public static string SerializeIssueToJsonString( this ICakeContext context, IIssue issue) { context.NotNull(nameof(context)); issue.NotNull(nameof(issue)); return(issue.SerializeToJsonString()); }
private static void SelectionIssueProcessing(IIssue issue) { for (var i = 0; i < SelectionIssueAnswerNumber; i++) { issue.Answers.Add(new Answer { IsCorrect = i == 0 }); } }
protected override IssueRepository CreateSut() { connection = Mock <IConnection>(); issue = Mock <IIssue>(); deSerializedIssueMock = new DeserializedIssueMock(issue); commentCollection = CreateCommentsWrapper(); issueFactory = Mock <IIssueFactory>(); return(new IssueRepository(connection, issueFactory)); }
public static void Close(IIssue Issue) { SqlParameter[] _parameters = { new SqlParameter("@Id", Issue.Id) , new SqlParameter("@IsClosed", Issue.IsClosed) , new SqlParameter("@SysModifier", Issue.SysModifier) }; SqlHelper.ExecuteNonQuery(ConnectionString, "sp_Issues_CloseById", _parameters); }
/// <summary> /// Checks if there's already a comment for an issue. /// </summary> /// <param name="issue">Issue to check.</param> /// <param name="issueComments">List of existing comments.</param> /// <returns>True if there are already comments for an issue.</returns> private static bool IssueHasMatchingComments( IIssue issue, IDictionary <IIssue, IssueCommentInfo> issueComments) { return (issueComments.ContainsKey(issue) && ( issueComments[issue].ActiveComments.Any() || issueComments[issue].WontFixComments.Any() || issueComments[issue].ResolvedComments.Any())); }
public static void SerializeIssueToJsonFile( this ICakeContext context, IIssue issue, FilePath filePath) { context.NotNull(nameof(context)); issue.NotNull(nameof(issue)); filePath.NotNull(nameof(filePath)); issue.SerializeToJsonFile(filePath); }
public void Should_Throw_If_Issue_Is_Null() { // Given IIssue issue = null; // When var result = Record.Exception(() => FileLinkSettings.ForPattern("foo").GetFileLink(issue)); // Then result.IsArgumentNullException("issue"); }
public override async void OnNavigatedTo(NavigationParameters parameters) { base.OnNavigatedTo(parameters); _issue = parameters[Constants.IssueParameterName] as IIssue; _repo = parameters[Constants.RepoParameterName] as IRepo; Title = string.Format(Resources.Strings.WorkLogs.IssueTitle, _issue?.Number); await LoadWorkLogsAsync(Loader); }
public void Should_Throw_If_Issue_Is_Null() { // Given IIssue issue = null; // When var result = Record.Exception(() => issue.GetExpandoObject()); // Then result.IsArgumentNullException("issue"); }
/// <summary> /// Checks values of an issue. /// </summary> /// <param name="issueToCheck">Issue which should be checked.</param> /// <param name="expectedIssue">Description of the expected issue.</param> public static void Check( IIssue issueToCheck, IssueBuilder expectedIssue) { issueToCheck.NotNull(nameof(issueToCheck)); expectedIssue.NotNull(nameof(expectedIssue)); Check( issueToCheck, expectedIssue.Create()); }
/// <summary> /// Gets the message of the issue in a specific format. /// If the message is not available in the specific format, the message in /// text format will be returned. /// </summary> /// <param name="issue">Issue for which the message should be returned.</param> /// <param name="format">Format in which the message should be returned.</param> /// <returns>Message in the format specified by <paramref name="format"/> or message in text /// format if it is not available in the desired format.</returns> public static string Message(this IIssue issue, IssueCommentFormat format) { issue.NotNull(nameof(issue)); return(format switch { IssueCommentFormat.PlainText => issue.MessageText, IssueCommentFormat.Html => !string.IsNullOrEmpty(issue.MessageHtml) ? issue.MessageHtml : issue.MessageText, IssueCommentFormat.Markdown => !string.IsNullOrEmpty(issue.MessageMarkdown) ? issue.MessageMarkdown : issue.MessageText, _ => throw new ArgumentOutOfRangeException(nameof(format)), });
public virtual bool AreEqual(IIssueModel model, IIssue entity) { return NameableEntityMapper.AreEqual(model, entity) // Issue Properties && model.HasStaffReview == entity.HasStaffReview && model.CoverDate == entity.CoverDate && model.StoreDate == entity.StoreDate && model.IssueNumber == entity.IssueNumber // Related Objects && model.PrimaryImageFileId == entity.PrimaryImageFileId && model.VolumeId == entity.VolumeId ; }
/// <summary> /// Adds the specified issue to the list unless it is an exact duplicate of another instance. /// </summary> /// <param name="i"></param> public virtual void AcceptIssue(IIssue i) { //Set default source value if (i.Source == null && i as Issue != null) ((Issue)i).Source = defaultSource; //Perform duplicate checking, then add item if unique. int hash = i.GetHashCode(); lock (issueSync) { if (!_issueSet.ContainsKey(hash)) { _issueSet[hash] = i; _issues.Add(i); } } }
public virtual void MapToEntity(IIssueModel model, ref IIssue entity, int currentDepth = 1) { currentDepth++; // Assign Base properties NameableEntityMapper.MapToEntity(model, ref entity); // Issue Properties entity.HasStaffReview = model.HasStaffReview; entity.CoverDate = model.CoverDate; entity.StoreDate = model.StoreDate; entity.IssueNumber = model.IssueNumber; // Related Objects entity.PrimaryImageFileId = model.PrimaryImageFileId; entity.PrimaryImageFile = (ImageFile)model.PrimaryImageFile?.MapToEntity(); entity.VolumeId = model.VolumeId; entity.Volume = (Volume)model.Volume?.MapToEntity(); // Associated Objects entity.IssueAliases = model.IssueAliases?.Where(i => i.Active).Select(IssueAliasMapperExtensions.MapToEntity).ToList(); entity.IssueStoryArcs = model.IssueStoryArcs?.Where(i => i.Active).Select(StoryArcIssueMapperExtensions.MapToEntity).ToList(); entity.IssueWriters = model.IssueWriters?.Where(i => i.Active).Select(IssueWriterMapperExtensions.MapToEntity).ToList(); }
public void Add(IIssue entity) { Context.Issues.Add((Issue)entity); }
/// <summary> /// Generate issue tree as String (Windows CRLF line breaks) /// Level /// </summary> /// <param name="issue"></param> private String issueTreeOutput(IIssue issue) { String s = issue.AppTreeNode.Path + "\r\n"; bool entityWritten = false; foreach (ITest t in issue.Variants) { foreach (IDifference d in t.Differences) { if (!entityWritten) { s += "\t" + d.Name + "\r\n"; entityWritten = true; } s += "\t\t" + d.Altered + "\r\n"; } } return s; }
public void Deactivate(IIssue entity) { entity.Active = false; Update(entity); }
public void AcceptIssue(IIssue i) { //Ignore duplicate errors loading xml }
protected bool Deactivate(IIssue entity) { // Deactivate it IssuesRepository.Deactivate(entity); // Try to Save Changes IssuesRepository.SaveChanges(); // Finished! return true; }
protected bool Remove(IIssue entity) { if (entity == null) { return true; } // No entity found to remove, consider it passed // Remove it IssuesRepository.Remove(entity); // Try to Save Changes IssuesRepository.SaveChanges(); // Finished! return true; }
public IEnumerable<IComment> GetComments(IIssue issue) { Console.WriteLine("Getting comments for issue with Id: {0}", issue.Id); return issue.Comments; }
public IssueItemView(IssuesListView view, IIssue issue) { _view = view; _issue = issue; }
internal bool IsSelected(IIssue issue) { bool val; return _selected.TryGetValue(issue.Id, out val) && val; }
string GetIssueId(IIssue issue, string commonRoot) { var prefix = GetSetting("jira:idprefix", commonRoot); return !String.IsNullOrEmpty(prefix) ? issue.DisplayId.Replace(prefix, String.Empty) : issue.DisplayId; }
public void Remove(IIssue entity) { Context.Issues.Remove((Issue)entity); }
private void SetNewIssue(IIssue issue) { // ReSharper disable PossibleNullReferenceException _currentSet = issue.Set; // ReSharper restore PossibleNullReferenceException CurrentIssue = issue; CurrentIssueNumber = SetIssues.IndexOf(CurrentIssue); switch (IssueType) { case IssueTypes.Selection: Answers[0].SelectedByUser = true; break; case IssueTypes.SelectionInImage: Answers[0].UserAnswer = 1u; break; } RaiseInterfaceUpdate(); }
public void AttachFile(IIssue issue, byte[] bytes, string fileName) { Console.WriteLine("Attaching file {0} for Issue with Id: {1}", fileName, issue.Id); issue.AttachFile(fileName, bytes); }
///<summary> /// Submit the specified issue. ///</summary> /// <remarks>If the mantis issue being updated does not have a category and MantisConnect is configured with /// $g_mc_error_when_category_not_found = ON, an exception will be thrown by the server.</remarks> /// <exception cref="MCException"></exception> public long AddIssue(IIssue issue) { var mc = CreateMantisClientProxyInstance(); try { return Convert.ToInt64(mc.mc_issue_add(Username, Password, ((Issue)issue).Data)); } catch (Exception ex) { throw new MCException("Could not add issue", ex); } finally { mc.CloseSafely(); } }
public IEnumerable<IAttachment> GetAttachments(IIssue issue) { Console.WriteLine("Getting attachments for Issue with Id: {0}", issue.Id); return issue.GetAttachments(); }
public void AddCommentToIssue(IIssue issue, string comment) { Console.WriteLine("Adding comment {0} to Issue with Id: {1}", comment, issue.Id); issue.AddComment(comment); }
public IssueViewModel(IIssue issue) { Issue = issue; }
public DeserializedIssueMock(IIssue issue) { this.issue = issue; }
protected void SaveIssue(IIssue issue) { ScenarioContext.Current.Set(issue, "savedIssue"); }
internal void Select(IIssue issue, bool select) { if (IsSelected(issue) != select) { if (select) _selected[issue.Id] = select; else _selected.Remove(issue.Id); RebuildActions(); OnPropertyChanged("CanAddWorklog"); } }
public CachedItem(IIssue issue) { this.Issue = issue; this.TimeCached = DateTime.Now; }
public IssueItemView(IssuesListView view, IIssue issue) { this._view = view; this.Issue = issue; }
public void RemoveCommentForIssue(IIssue issue) { IEnumerable<IComment> comments = issue.Comments; string commentId = comments.Single().Id; Console.WriteLine("Removing comment {0} for Issue with Id: {1}", commentId, issue.Id); issue.RemoveComment(commentId); }
public void Update(IIssue entity) { Context.SetModified(entity); }
public IssueViewModel(IIssue issue) { this.issue = issue; }