public void Validation_Exception_Should_Be_Thrown_When_Null_Validated()
        {
            var toscaValidator = new ToscaValidator <ToscaServiceTemplate>();

            Action action = () => toscaValidator.Validate(null);

            action.ShouldThrow <ToscaValidationException>().WithMessage("Tosca is null or empty");
        }
Beispiel #2
0
        public void ToscaDefinitionsVersion_Valid_NoException()
        {
            // Arrange
            var toscaSimpleProfile = new ToscaServiceTemplate
            {
                ToscaDefinitionsVersion = "tosca_simple_yaml_1_0"
            };

            var toscaValidator = new ToscaValidator <ToscaServiceTemplate>();

            // Act
            Action action = () => toscaValidator.Validate(toscaSimpleProfile);

            // Assert
            action.ShouldNotThrow <Exception>();
        }
Beispiel #3
0
        public void ToscaDefinitionsVersion_Invalid_ValidationExceptionThrown()
        {
            // Arrange
            var toscaSimpleProfile = new ToscaServiceTemplate
            {
                ToscaDefinitionsVersion = "INVALID"
            };

            var toscaValidator = new ToscaValidator <ToscaServiceTemplate>();

            // Act
            Action action = () => toscaValidator.Validate(toscaSimpleProfile);

            // Assert
            action.ShouldThrow <ToscaValidationException>()
            .WithMessage("tosca_definitions_version shall be tosca_simple_yaml_1_0");
        }