コード例 #1
0
        public void GivenTheMessageIsNullWhenAddMessageIsCalledThenAnArgumentNullExceptionIsThrown()
        {
            // Arrange.
            var message = NullBuilder.Build <Message>();

            // Act.
            Action action = () => this.systemUnderTest.AddMessage(message);

            // Assert.
            action.Should().Throw <ArgumentNullException>();
        }
コード例 #2
0
        public void GivenTheMessageIsNullWhenEditMessageIsCalledThenAnArgumentNullExceptionIsThrown()
        {
            // Arrange.
            var id = Guid.NewGuid();
            var messageAddEditViewModel = NullBuilder.Build <MessageAddEditViewModel>();

            // Act.
            Action action = () => this.systemUnderTest.EditMessage(id, messageAddEditViewModel);

            // Assert.
            action.Should().Throw <ArgumentNullException>();
        }
コード例 #3
0
        public void GivenAMessageWithContentNullWhenValidateIsCalledThenTheMessageIsFoundToBeInvalid()
        {
            // Arrange.
            var content = NullBuilder.Build <string>();
            var messageAddEditViewModel = MessageAddEditViewModelBuilder
                                          .ABuilder()
                                          .WithContent(content)
                                          .Build();

            // Act.
            var result = this.systemUnderTest.Validate(messageAddEditViewModel);

            // Assert.
            result.IsValid.Should().BeFalse();
            result.Errors.Should().HaveCount(1);
        }