public IEnumerable<Ticket> Load(string currentBranch) { var tickets = new List<Ticket>(); using (var stream = new StreamReader(ticketFilePath, Encoding.UTF8)) { Ticket pre = null; string line = ""; while ((line = stream.ReadLine()) != null) { if (line == "") continue; else if (line.StartsWith(" ")) pre.DetailInfo += (pre.DetailInfo == "" ? "" : "\n") + line.TrimStart(); else { var elem = line.Split(new[] { " " }, StringSplitOptions.None); var ticket = new Ticket() { ID = elem[0], Summary = elem[2], DetailInfo = "", IsCurrentBranch = ("id/" + elem[0]) == currentBranch }; pre = ticket; tickets.Add(ticket); } } } return tickets; }
public void チケットの等価性チェックができる() { var ticket = new Ticket() { ID = "1", Summary = "hoge", DetailInfo = "piyo", IsCurrentBranch = false }; Assert.That(ticket, Is.EqualTo(new Ticket() { ID = "1", Summary = "hoge", DetailInfo = "piyo", IsCurrentBranch = false })); }