コード例 #1
0
        public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
        {
            var request = new EnrollAuthAppRequest
            {
                Code      = "code",
                SharedKey = "shared-key",
            };
            var validator = new EnrollAuthAppRequest.Validator();
            var result    = validator.Validate(request);

            Assert.True(result.IsValid);
        }
コード例 #2
0
        public void Validate_GivenSharedKeyIsNull_ExpectValidationFailure()
        {
            var request = new EnrollAuthAppRequest
            {
                Code      = "code",
                SharedKey = null,
            };
            var validator = new EnrollAuthAppRequest.Validator();
            var result    = validator.Validate(request);

            Assert.False(result.IsValid);
            Assert.Contains(
                result.Errors,
                failure => failure.PropertyName == "SharedKey");
        }
コード例 #3
0
        public void Validate_GivenCodeIsEmpty_ExpectValidationFailure()
        {
            var request = new EnrollAuthAppRequest
            {
                Code      = string.Empty,
                SharedKey = "shared-key",
            };
            var validator = new EnrollAuthAppRequest.Validator();
            var result    = validator.Validate(request);

            Assert.False(result.IsValid);
            Assert.Contains(
                result.Errors,
                failure => failure.PropertyName == "Code");
        }