Skip to content

Commit

Permalink
Add comment and Assert.DoesNotThrow to RequiredFieldsNoThrow
Browse files Browse the repository at this point in the history
  • Loading branch information
ObsidianMinor committed Dec 2, 2019
1 parent f084d62 commit 1a0ff95
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,14 @@ public void RequiredFields()
Assert.True(message.IsInitialized());
}

// Code was accidentally left in message parser that threw exceptions when missing required fields after parsing.
// We've decided to not throw exceptions on missing fields, instead leaving it up to the consumer how they
// want to check and handle missing fields.
[Test]
public void RequiredFieldsNoThrow()
{
TestRequired.Parser.ParseFrom(new byte[0]);
(TestRequired.Parser as MessageParser).ParseFrom(new byte[0]);
Assert.DoesNotThrow(() => TestRequired.Parser.ParseFrom(new byte[0]));
Assert.DoesNotThrow(() => (TestRequired.Parser as MessageParser).ParseFrom(new byte[0]));
}

[Test]
Expand Down

0 comments on commit 1a0ff95

Please sign in to comment.