예제 #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>();
        }
        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);
        }