public void Add_WhenAddedAllEntryLinesAndAddingNextEntryLine_ShouldSetCompleteEntry() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 2); // Act testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 3); // Assert testee.CompleteEntry.Should().NotBeNull(); }
public void Add_WhenMsgstrIsOnOneLine_ShouldTakeText() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 2); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 3); // Assert testee.CompleteEntry.MessageString.Should().Be("The msgstr text"); }
public void Add_WhenEntryHasComment_ShouldCreateEntryWithComment() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.Comment, ", the comment text"), 1); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 2); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 3); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 4); // Assert testee.CompleteEntry.Comments[0].Should().Be(", the comment text"); }
public void Add_WhenEntryHasMsgidPlural_ShouldCreateEntryWithMsgidPlural() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageIdPlural, "The msgid_plural text"), 2); testee.Add(new ParseResult(LineType.MessageStringPlural, "The msgstr[0] text"), 3); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 4); // Assert testee.CompleteEntry.MessageIdPlural.Should().Be("The msgid_plural text"); }
public void Add_WhenMsgstrOnOneLine_ShouldSetMsgstrLocationToOneLine() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 2); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 3); // Assert testee.CompleteEntry.MessageStringStart.Should().Be(2); testee.CompleteEntry.MessageStringEnd.Should().Be(2); }
public void Add_WhenMsgidHasPlural_ShouldSetMsgidLocationToAllTheLines() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageIdPlural, "The msgid_plural text"), 2); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 3); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 4); // Assert testee.CompleteEntry.MessageIdStart.Should().Be(1); testee.CompleteEntry.MessageIdEnd.Should().Be(2); }
public void Add_WhenMsgstrIsOnMultipleLinesStartingWithEmptyString_ShouldTakeAllText() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageString, ""), 2); testee.Add(new ParseResult(LineType.Text, "The text"), 3); testee.Add(new ParseResult(LineType.Text, "The second text"), 4); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 5); // Assert testee.CompleteEntry.MessageString.Should().Be("The textThe second text"); }
public void Add_WhenEntryStartsWithMsgid_ShouldSetCorrectEntryLocation() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.Empty, string.Empty), 1); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 2); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 3); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 4); // Assert testee.CompleteEntry.Start.Should().Be(2); testee.CompleteEntry.End.Should().Be(3); }
public void Add_WhenMsgstrOnMultipleLines_ShouldSetMsgstrContextToAllTheLines() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageString, ""), 2); testee.Add(new ParseResult(LineType.Text, "The text"), 3); testee.Add(new ParseResult(LineType.Text, "The second text"), 4); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 5); // Assert testee.CompleteEntry.MessageStringStart.Should().Be(2); testee.CompleteEntry.MessageStringEnd.Should().Be(4); }
public void Add_WhenNotAddedAllEntryLines_ShouldCompleteEntryBeNull() { // Arrange var testee = new EntryBuilder(); // Act testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); // Assert testee.CompleteEntry.Should().BeNull(); }
public void Add_WhenOneEntryAfterTheOther_ShouldNotHaveEntryDataFromPrevious() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageContext, "The msgctxt text"), 1); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 2); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 3); // Act testee.Add(new ParseResult(LineType.MessageId, "The second msgid text"), 4); testee.Add(new ParseResult(LineType.MessageString, "The second msgstr text"), 5); testee.Add(new ParseResult(LineType.Empty, string.Empty), 6); // Assert testee.CompleteEntry.MessageContext.Should().BeEmpty(); }
public void Add_WhenMsgctxtIsOnMultipleLines_ShouldTakeAllText() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageContext, "The msgctxt start"), 1); testee.Add(new ParseResult(LineType.Text, " middle"), 2); testee.Add(new ParseResult(LineType.Text, " end"), 3); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 4); testee.Add(new ParseResult(LineType.MessageString, "The msgstr text"), 5); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 6); // Assert testee.CompleteEntry.MessageContext.Should().Be("The msgctxt start middle end"); }
public void Add_WhenMsgstrPlurals_ShouldSetMsgstrContextToAllTheLines() { // Arrange var testee = new EntryBuilder(); testee.Add(new ParseResult(LineType.MessageId, "The msgid text"), 1); testee.Add(new ParseResult(LineType.MessageIdPlural, "The msgid_plural text"), 2); testee.Add(new ParseResult(LineType.MessageStringPlural, "The msgstr[0] text"), 3); testee.Add(new ParseResult(LineType.MessageStringPlural, "The msgstr[1] text"), 4); testee.Add(new ParseResult(LineType.MessageStringPlural, "The msgstr[2] text"), 5); // Act testee.Add(new ParseResult(LineType.Empty, string.Empty), 6); // Assert testee.CompleteEntry.MessageStringStart.Should().Be(3); testee.CompleteEntry.MessageStringEnd.Should().Be(5); }