public void Validate_TypeWithArrayOfIntegersAreCorrect_Success() { var instance = new TypeWithArrayOfIntegers { IntegersArray = new[] { 11, 50, 99, 100, 10 } }; var result = RecursiveValidator.Validate(instance); result.Should().BeOfType <SuccessfulResult>(); }
public void Validate_TypeWithArrayOfIntegersOverheadsRange_Fails() { var instance = new TypeWithArrayOfIntegers { IntegersArray = new[] { 11, 111 } }; var result = RecursiveValidator.Validate(instance); result.Should().BeOfType <FailedResult>() .Which.Code.Should().Be(CoreErrorCodes.ValidationFailed.Code); var errorDetails = ((FailedResult)result).Details.ToArray(); errorDetails.Length.Should().Be(1); errorDetails[0].Source.Should().Be($"{nameof(TypeWithArrayOfIntegers)}.{nameof(TypeWithArrayOfIntegers.IntegersArray)}.1"); errorDetails[0].CodeInfo.Code.Should().BeEquivalentTo(AnnotationErrorCodes.Range.Code); }