public void Render_should_not_render_committer_info_if_same_as_author_info() { var author = "John Doe (Acme Inc) <*****@*****.**>"; var committer = author; var authorDate = DateTime.Parse("2017-06-17T16:38:40+03"); var commitDate = authorDate; var data = new CommitData("8ea78df688ec4719a9756c1199a515d1", Guid.NewGuid().ToString("N"), new ReadOnlyCollection <string>(new List <string>()), author, authorDate, committer, commitDate, ""); _linkFactory.CreateLink(author, Arg.Any <string>()).Returns(x => author); _dateFormatter.FormatDateAsRelativeLocal(authorDate).Returns("6 months ago (06/17/2017 23:38:40)"); var result = _renderer.Render(data, false); result.Should().Be($"Author: John Doe (Acme Inc) <*****@*****.**>{Environment.NewLine}Date: 6 months ago (06/17/2017 23:38:40){Environment.NewLine}Commit hash: 8ea78df688ec4719a9756c1199a515d1"); _labelFormatter.Received(1).FormatLabel(Strings.GetAuthorText(), Arg.Any <int>()); _labelFormatter.Received(1).FormatLabel(Strings.GetDateText(), Arg.Any <int>()); _labelFormatter.Received(1).FormatLabel(Strings.GetCommitHashText(), Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(Strings.GetAuthorDateText(), Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(Strings.GetCommitterText(), Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(Strings.GetCommitDateText(), Arg.Any <int>()); }
public void Render_should_not_render_committer_info_if_same_as_author_info() { var author = "John Doe (Acme Inc) <*****@*****.**>"; var committer = author; var authorDate = DateTime.Parse("2017-06-17T16:38:40+03"); var commitDate = authorDate; var data = new CommitData( ObjectId.Parse("7fa3109989e0523aeacb178995a2a3aa6c302a2c"), ObjectId.Random(), Array.Empty <ObjectId>(), author, authorDate, committer, commitDate, ""); _linkFactory.CreateLink(author, Arg.Any <string>()).Returns(x => author); _dateFormatter.FormatDateAsRelativeLocal(authorDate).Returns("6 months ago (06/17/2017 23:38:40)"); var result = _renderer.Render(data, false); result.Should().Be($"Author: John Doe (Acme Inc) <*****@*****.**>{Environment.NewLine}Date: 6 months ago (06/17/2017 23:38:40){Environment.NewLine}Commit hash: 7fa3109989e0523aeacb178995a2a3aa6c302a2c"); _labelFormatter.Received(1).FormatLabel(TranslatedStrings.Author, Arg.Any <int>()); _labelFormatter.Received(1).FormatLabel(TranslatedStrings.Date, Arg.Any <int>()); _labelFormatter.Received(1).FormatLabel(TranslatedStrings.CommitHash, Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(TranslatedStrings.AuthorDate, Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(TranslatedStrings.Committer, Arg.Any <int>()); _labelFormatter.DidNotReceive().FormatLabel(TranslatedStrings.CommitDate, Arg.Any <int>()); }