Beispiel #1
0
        public void TryValidateCreateRoleRequest_GivenInvalidCharacter_DoesNotValidate()
        {
            // Arrange
            var sut     = new CreateIAMRoleRequestValidator();
            var request = new CreateIAMRoleRequest
            {
                Name = "å"
            };
            var validationErros = string.Empty;

            // Act
            var validRequest = sut.TryValidateCreateRoleRequest(request, out validationErros);

            // Assert
            Assert.False(validRequest);
            Assert.NotEqual(string.Empty, validationErros);
        }
Beispiel #2
0
        public void TryValidateCreateRoleRequest_GivenValidInput_Validates()
        {
            // Arrange
            var sut     = new CreateIAMRoleRequestValidator();
            var request = new CreateIAMRoleRequest
            {
                Name = "MyRole"
            };
            var validationErros = string.Empty;

            // Act
            var validRequest = sut.TryValidateCreateRoleRequest(request, out validationErros);

            // Assert
            Assert.True(validRequest);
            Assert.Equal(string.Empty, validationErros);
        }
Beispiel #3
0
        public void TryValidateCreateRoleRequest_GivenTooLongRoleName_DoesNotValidate()
        {
            // Arrange
            var sut = new CreateIAMRoleRequestValidator();
            var roleNameLongerThan64Characters = new string('*', 65);
            var request = new CreateIAMRoleRequest
            {
                Name = roleNameLongerThan64Characters
            };
            var validationErros = string.Empty;

            // Act
            var validRequest = sut.TryValidateCreateRoleRequest(request, out validationErros);

            // Assert
            Assert.False(validRequest);
            Assert.NotEqual(string.Empty, validationErros);
        }