public void Base_Property_Of_Root_NodeType_Should_Be_Null() { // Arrange var deviceNodeType = new ToscaNodeType(); deviceNodeType.Properties.Add("vendor", new ToscaProperty { Type = "string" }); var switchNodeType = new ToscaNodeType { DerivedFrom = "tosca.nodes.Device" }; switchNodeType.Properties.Add("speed", new ToscaProperty { Type = "integer" }); var serviceTemplate = new ToscaServiceTemplate { ToscaDefinitionsVersion = "tosca_simple_yaml_1_0" }; serviceTemplate.NodeTypes.Add("tosca.nodes.Switch", switchNodeType); serviceTemplate.NodeTypes.Add("tosca.nodes.Device", deviceNodeType); // Act var cloudServiceArchive = new ToscaCloudServiceArchive(new ToscaMetadata()); cloudServiceArchive.AddToscaServiceTemplate("tosca.yaml", serviceTemplate); // Assert deviceNodeType.DerivedFrom.Should().Be(ToscaDefaults.ToscaNodesRoot); deviceNodeType.GetDerivedFromEntity().Attributes.Should().ContainKey("tosca_id", "tosca.nodes.Root has tosca_id property"); }
public void Base_Property_Set_To_NodeType_Instance_Of_Derived_From() { // Arrange var deviceNodeType = new ToscaNodeType(); deviceNodeType.Properties.Add("vendor", new ToscaProperty { Type = "string" }); var switchNodeType = new ToscaNodeType { DerivedFrom = "tosca.nodes.Device" }; switchNodeType.Properties.Add("speed", new ToscaProperty { Type = "integer" }); var serviceTemplate = new ToscaServiceTemplate { ToscaDefinitionsVersion = "tosca_simple_yaml_1_0" }; serviceTemplate.NodeTypes.Add("tosca.nodes.Switch", switchNodeType); serviceTemplate.NodeTypes.Add("tosca.nodes.Device", deviceNodeType); // Act var cloudServiceArchive = new ToscaCloudServiceArchive(new ToscaMetadata()); cloudServiceArchive.AddToscaServiceTemplate("tosca.yaml", serviceTemplate); // Assert switchNodeType.GetDerivedFromEntity().Properties.Should().ContainKey("vendor"); }