public void GetArtifactBytes_OnCloudServiceArchive_Without_Artifacts_Should_Throw_ArtifactNotFoundException()
        {
            var toscaCloudServiceArchive = new ToscaCloudServiceArchive(new ToscaMetadata());

            Action action = () => toscaCloudServiceArchive.GetArtifactBytes("not_existing_file.png");

            action.ShouldThrow <ToscaArtifactNotFoundException>()
            .WithMessage("Artifact 'not_existing_file.png' not found in Cloud Service Archive.");
        }
        public void GetArtifactBytes_Should_Throw_ArtifactNotFoundException_When_File_Missing_In_Archive()
        {
            // Act
            var toscaServiceTemplate = new ToscaServiceTemplate();
            var toscaNodeType        = new ToscaNodeType();

            toscaServiceTemplate.NodeTypes.Add("device", toscaNodeType);
            var toscaCloudServiceArchive = new ToscaCloudServiceArchive(new ToscaMetadata
            {
                EntryDefinitions = "tosca.yaml"
            });

            // Act
            Action action = () => toscaCloudServiceArchive.GetArtifactBytes("NOT_EXISTING.png");

            // Assert
            action.ShouldThrow <ToscaArtifactNotFoundException>()
            .WithMessage("Artifact 'NOT_EXISTING.png' not found in Cloud Service Archive.");
        }
        public void GetArtifactBytes_Should_Return_Empty_Array_When_File_Is_Empty()
        {
            // Arrange
            var toscaMetadata = new ToscaMetadata
            {
                CreatedBy            = "Devil",
                CsarVersion          = new Version(1, 1),
                ToscaMetaFileVersion = new Version(1, 0),
                EntryDefinitions     = "tosca.yaml"
            };

            var toscaCloudServiceArchive = new ToscaCloudServiceArchive(toscaMetadata);

            // Act
            toscaCloudServiceArchive.AddArtifact("some_icon.png", "IMAGE".ToByteArray(Encoding.ASCII));

            // Assert
            toscaCloudServiceArchive.GetArtifactBytes("some_icon.png")
            .Should()
            .BeEquivalentTo(new byte[] { 73, 77, 65, 71, 69 });
        }