public void Create() { var group = new GroupCompositionId(); var part = new PartRegistrationId("a", 1); var id = new PartCompositionId(group, part); Assert.AreEqual(group, id.Group); Assert.AreEqual(part, id.Part); }
/// <summary> /// Initializes a new instance of the <see cref="PartCompositionId"/> class. /// </summary> /// <param name="group">The ID of the composed group that owns the current part.</param> /// <param name="part">The ID of the part registration that determines what the current part is.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="group"/> is <see langword="null" />. /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="part"/> is <see langword="null" />. /// </exception> public PartCompositionId(GroupCompositionId group, PartRegistrationId part) { { Lokad.Enforce.Argument(() => group); Lokad.Enforce.Argument(() => part); } m_Group = group; m_Part = part; }
/// <summary> /// Initializes a new instance of the <see cref="GroupPartDefinition"/> class. /// </summary> /// <param name="partType">The type of object for which this ID is valid.</param> /// <param name="number">The index of the object in the owning group.</param> /// <param name="exports">The collection of export registrations for the current object.</param> /// <param name="imports">The collection of import registrations for the current object.</param> /// <param name="actions">The collection of schedule action registrations for the current object.</param> /// <param name="conditions">The collection of schedule import registrations for the current object.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="partType"/> is <see langword="null" />. /// </exception> public GroupPartDefinition( TypeIdentity partType, int number, Dictionary <ExportRegistrationId, SerializableExportDefinition> exports, Dictionary <ImportRegistrationId, SerializableImportDefinition> imports, Dictionary <ScheduleActionRegistrationId, ScheduleActionDefinition> actions, Dictionary <ScheduleConditionRegistrationId, ScheduleConditionDefinition> conditions) { { Lokad.Enforce.Argument(() => partType); } m_Id = new PartRegistrationId(partType.AssemblyQualifiedName, number); m_Type = partType; m_Index = number; m_Exports = exports ?? new Dictionary <ExportRegistrationId, SerializableExportDefinition>(); m_Imports = imports ?? new Dictionary <ImportRegistrationId, SerializableImportDefinition>(); m_Actions = actions ?? new Dictionary <ScheduleActionRegistrationId, ScheduleActionDefinition>(); m_Conditions = conditions ?? new Dictionary <ScheduleConditionRegistrationId, ScheduleConditionDefinition>(); }
/// <summary> /// Initializes a new instance of the <see cref="GroupPartDefinition"/> class. /// </summary> /// <param name="partType">The type of object for which this ID is valid.</param> /// <param name="number">The index of the object in the owning group.</param> /// <param name="exports">The collection of export registrations for the current object.</param> /// <param name="imports">The collection of import registrations for the current object.</param> /// <param name="actions">The collection of schedule action registrations for the current object.</param> /// <param name="conditions">The collection of schedule import registrations for the current object.</param> /// <exception cref="ArgumentNullException"> /// Thrown if <paramref name="partType"/> is <see langword="null" />. /// </exception> public GroupPartDefinition( TypeIdentity partType, int number, Dictionary<ExportRegistrationId, SerializableExportDefinition> exports, Dictionary<ImportRegistrationId, SerializableImportDefinition> imports, Dictionary<ScheduleActionRegistrationId, ScheduleActionDefinition> actions, Dictionary<ScheduleConditionRegistrationId, ScheduleConditionDefinition> conditions) { { Lokad.Enforce.Argument(() => partType); } m_Id = new PartRegistrationId(partType.AssemblyQualifiedName, number); m_Type = partType; m_Index = number; m_Exports = exports ?? new Dictionary<ExportRegistrationId, SerializableExportDefinition>(); m_Imports = imports ?? new Dictionary<ImportRegistrationId, SerializableImportDefinition>(); m_Actions = actions ?? new Dictionary<ScheduleActionRegistrationId, ScheduleActionDefinition>(); m_Conditions = conditions ?? new Dictionary<ScheduleConditionRegistrationId, ScheduleConditionDefinition>(); }