Пример #1
0
        public void Error_GivenCollectionOfErrors_ReturnsRuleOperationResultWithErrorsAndNoSuccess()
        {
            // Arrange
            IEnumerable <string> errors = new[] { "Error1", "Error2" };

            // Act
            RuleOperationResult ruleOperationResult = RuleOperationResult.Error(errors);

            // Assert
            ruleOperationResult.Should().NotBeNull();
            ruleOperationResult.IsSuccess.Should().BeFalse();
            ruleOperationResult.Errors.Should().BeSameAs(errors);
        }
Пример #2
0
        public void Error_GivenNullCollectionOfErrors_ThrowsArgumentNullException()
        {
            // Arrange
            IEnumerable <string> errors = null;

            // Act
            ArgumentNullException argumentNullException = Assert.Throws <ArgumentNullException>(() => RuleOperationResult.Error(errors));

            // Assert
            argumentNullException.Should().NotBeNull();
            argumentNullException.ParamName.Should().Be(nameof(errors));
        }