public void Given_content_is_not_null_When_WithContent_is_called_Then_Content_should_be_set() { // Arrange. IClock clock = ConstantClockStub.Create(0); BlogPostBuilder builder = BlogPostBuilder.Create(clock); string content = "Content"; // Act. builder = builder.WithContent(content); // Assert. builder.Content.Should().Be(content); }
public void Given_content_is_null_When_WithContent_is_called_Then_an_ArgumentNullException_should_be_thrown() { // Arrange. IClock clock = ConstantClockStub.Create(0); BlogPostBuilder builder = BlogPostBuilder.Create(clock); string content = null; // Act. Action testCode = () => builder.WithContent(content); // Assert. testCode.Should() .Throw <ArgumentNullException>() .WithMessage("*cannot be null*content*"); }