public PartCreatorImporter( PartCreator <IId> idCreatorTCtor, PartCreator <IId, IIdTypeMetadata> idCreatorTMCtor) { this._idCreatorTCtor = idCreatorTCtor; this._idCreatorTMCtor = idCreatorTMCtor; }
private int VerifyPartCreator(PartCreator <IId, IIdTypeMetadata> creator) { var val = VerifyPartCreator((PartCreator <IId>)creator); Assert.AreEqual("PostiveIncrement", creator.Metadata.IdType, "IdType should be PositiveIncrement"); Assert.AreEqual(AttributedModelServices.GetTypeIdentity(typeof(ComposablePartDefinition)), creator.Metadata.ExportTypeIdentity); return(val); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { PartCreator <IShape, IShapeMetadata> partCreator = value as PartCreator <IShape, IShapeMetadata>; if (partCreator != null) { return(partCreator.CreatePart().ExportedValue); } throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture, "value is {0}", value.GetType().FullName)); } throw new ArgumentNullException("value"); }
private int VerifyPartCreator(PartCreator <IId> creator) { var val1 = creator.CreatePart(); var val2 = creator.CreatePart(); Assert.AreNotEqual(val1.ExportedValue, val2.ExportedValue, "Values should not be the same"); Assert.AreNotEqual(val1.ExportedValue.Id, val2.ExportedValue.Id, "Value Ids should not be the same"); Assert.IsTrue(val1.ExportedValue.Id >= 0, "Id should be positive"); val1.Dispose(); Assert.IsTrue(val1.ExportedValue.Id < 0, "Disposal of the value should set the id to negative"); return(creator.CreatePart().ExportedValue.Id); }
public SpaceObjectBindingHelper(PartCreator<SpaceObject, ISpaceObjectMetadata> creator) { Creator = creator; SpaceObject = Creator.CreatePart().ExportedValue; }