public void ItShallFailOnUnsetConstructorValueOnly() { // Given var builder = new AnswerToEveryThingBuilder() .WithValue(0) .WithQuestion("test"); // When Action when = () => builder.Build(); // Then when.Should().Throw <InvalidOperationException>() .Which.Message.Should().Contain(nameof(AnswerToEveryThing.Author)); }
public void ItShallIgnoreDefaultValuesEvenNonNullable() { // Given var builder = new AnswerToEveryThingBuilder() .WithAuthor("UnitTest") .WithCreationDate(DateTime.UtcNow); // When var answer = builder.Build(); // Then answer.Value.Should().Be(42); answer.Question.Should().BeNull(); }