public void InitializeContext() { var store = new DslTestStore <PatternModelDomainModel>(); PatternModelSchema patternModel = null; store.TransactionManager.DoWithinTransaction(() => { patternModel = store.ElementFactory.CreateElement <PatternModelSchema>(); }); var serviceProvider = Mock.Get(store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of <IPatternManager>(p => p.InstalledToolkits == new List <IInstalledToolkitInfo>())); var uriService = Mock.Of <IUriReferenceService>( u => u.ResolveUri <IInstanceBase>(It.IsAny <Uri>()) == Mock.Of <IProduct>(p => p.ToolkitInfo.Identifier == "AuthoredToolkit")); var patternSchema = patternModel.Create <PatternSchema>(); patternSchema.Name = "FooPattern"; patternSchema.PatternLink = "patternmanager://foo"; patternSchema.UriService = uriService; this.view = patternSchema.Create <ViewSchema>(); this.view.Name = "View1"; store.TransactionManager.DoWithinTransaction(() => { this.extensionPoint = store.ElementFactory.CreateElement <ExtensionPointSchema>("ExtensionPoint1"); this.view.ExtensionPoints.Add(this.extensionPoint); }); }
public void InitializeContext() { this.store.TransactionManager.DoWithinTransaction(() => { this.extensionPoint = this.store.ElementFactory.CreateElement<ExtensionPointSchema>(); }); }
public void InitializeContext() { this.store.TransactionManager.DoWithinTransaction(() => { this.extensionPoint = this.store.ElementFactory.CreateElement <ExtensionPointSchema>(); }); }
public void InitializeContext() { var uriService = Mock.Of <IUriReferenceService>( u => u.ResolveUri <IInstanceBase>(It.IsAny <Uri>()) == Mock.Of <IProduct>(p => p.ToolkitInfo.Identifier == "ToolkitId")); var serviceProvider = Mock.Get(this.store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of <IPatternManager>(p => p.InstalledToolkits == new List <IInstalledToolkitInfo>())); ExtensionPointSchema hosted = null; this.store.TransactionManager.DoWithinTransaction(() => { var patternModel = this.store.ElementFactory.CreateElement <PatternModelSchema>(); var patternSchema = patternModel.CreatePatternSchema() as PatternSchema; patternSchema.PatternLink = "patternmanager://foo"; patternSchema.UriService = uriService; var view = patternSchema.Create <ViewSchema>(); view.Name = "View1"; this.extensionPointSchema = view.Create <ExtensionPointSchema>(); this.extensionPointSchema.Name = "ep1"; hosted = view.Create <ExtensionPointSchema>(); hosted.Name = "hostedExtensionPoint"; var prop1 = hosted.Create <PropertySchema>(); prop1.Name = "PartiallyCustomizable"; prop1.Type = "System.String"; prop1.IsCustomizable = CustomizationState.True; prop1.EnsurePolicyAndDefaultSettings(); prop1.Policy.Settings[0].Value = false; var prop2 = hosted.Create <PropertySchema>(); prop2.Name = "FullyCustomizable"; prop2.Type = "System.String"; prop2.IsCustomizable = CustomizationState.False; prop2.EnsurePolicyAndDefaultSettings(); }); this.hostedExtensionPoint = hosted as IExtensionPointSchema; this.userMessageService = new Mock <IUserMessageService>(); var defaultDescriptor = TypeDescriptor.CreateProperty(typeof(ExtensionPointSchema), Reflector <ExtensionPointSchema> .GetPropertyName(e => e.RepresentedExtensionPointId), typeof(string), null); this.descriptor = new HostedExtensionPointPropertyDescriptor( defaultDescriptor, this.extensionPointSchema, this.userMessageService.Object); }
public void InitializeContext() { var uriService = Mock.Of<IUriReferenceService>( u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p => p.ToolkitInfo.Identifier == "ToolkitId")); var serviceProvider = Mock.Get(this.store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>())); ExtensionPointSchema hosted = null; this.store.TransactionManager.DoWithinTransaction(() => { var patternModel = this.store.ElementFactory.CreateElement<PatternModelSchema>(); var patternSchema = patternModel.CreatePatternSchema() as PatternSchema; patternSchema.PatternLink = "patternmanager://foo"; patternSchema.UriService = uriService; var view = patternSchema.Create<ViewSchema>(); view.Name = "View1"; this.extensionPointSchema = view.Create<ExtensionPointSchema>(); this.extensionPointSchema.Name = "ep1"; hosted = view.Create<ExtensionPointSchema>(); hosted.Name = "hostedExtensionPoint"; var prop1 = hosted.Create<PropertySchema>(); prop1.Name = "PartiallyCustomizable"; prop1.Type = "System.String"; prop1.IsCustomizable = CustomizationState.True; prop1.EnsurePolicyAndDefaultSettings(); prop1.Policy.Settings[0].Value = false; var prop2 = hosted.Create<PropertySchema>(); prop2.Name = "FullyCustomizable"; prop2.Type = "System.String"; prop2.IsCustomizable = CustomizationState.False; prop2.EnsurePolicyAndDefaultSettings(); }); this.hostedExtensionPoint = hosted as IExtensionPointSchema; this.userMessageService = new Mock<IUserMessageService>(); var defaultDescriptor = TypeDescriptor.CreateProperty(typeof(ExtensionPointSchema), Reflector<ExtensionPointSchema>.GetPropertyName(e => e.RepresentedExtensionPointId), typeof(string), null); this.descriptor = new HostedExtensionPointPropertyDescriptor( defaultDescriptor, this.extensionPointSchema, this.userMessageService.Object); }
public void InitializeContext() { var serviceProvider = Mock.Get(this.store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of <IPatternManager>(p => p.InstalledToolkits == new List <IInstalledToolkitInfo>())); ExtensionPointSchema extensionPoint1 = null; ExtensionPointSchema extensionPoint2 = null; this.store.TransactionManager.DoWithinTransaction(() => { var patternModel = this.store.ElementFactory.CreateElement <PatternModelSchema>(); var uriService = Mock.Of <IUriReferenceService>( u => u.ResolveUri <IInstanceBase>(It.IsAny <Uri>()) == Mock.Of <IProduct>(p => p.ToolkitInfo.Identifier == "ToolkitId")); this.patternSchema = patternModel.CreatePatternSchema() as PatternSchema; this.patternSchema.PatternLink = "patternmanager://foo"; this.patternSchema.UriService = uriService; var view = patternSchema.Create <ViewSchema>(); view.Name = "View1"; extensionPoint1 = view.Create <ExtensionPointSchema>(); extensionPoint1.Name = "ep1"; var prop1 = extensionPoint1.Create <PropertySchema>(); prop1.Name = "ContractProperty1"; prop1.Type = typeof(string).Name; extensionPoint2 = view.Create <ExtensionPointSchema>(); extensionPoint2.Name = "ep2"; var prop2 = extensionPoint2.Create <PropertySchema>(); prop2.Name = "ContractProperty1"; prop2.Type = typeof(double).Name; }); this.extensionPoints = new List <IExtensionPointSchema> { extensionPoint1, extensionPoint2 }; this.descriptor = new ProvidedExtensionPointsPropertyDescriptor( this.patternSchema, extensionPoints, new Mock <IUserMessageService>().Object, "ImplementedExtensionPointsRaw", string.Empty); }
public HostedExtensionPointPropertyDescriptor(PropertyDescriptor descriptor, ExtensionPointSchema extensionPoint, IUserMessageService messageService, params Attribute[] attributes) : base(descriptor, attributes) { this.extensionPoint = extensionPoint; this.messageService = messageService; }
public void InitializeContext() { var store = new DslTestStore<PatternModelDomainModel>(); var serviceProvider = Mock.Get(store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>())); PatternModelSchema authoredPatternModel = null; store.TransactionManager.DoWithinTransaction(() => { authoredPatternModel = store.ElementFactory.CreateElement<PatternModelSchema>(); }); var uriService = Mock.Of<IUriReferenceService>( u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p => p.ToolkitInfo.Identifier == "AuthoredToolkit")); var patternSchema = authoredPatternModel.Create<PatternSchema>(); patternSchema.Name = "FooPattern"; patternSchema.PatternLink = "patternmanager://foo"; patternSchema.UriService = uriService; this.view = patternSchema.Create<ViewSchema>(); this.view.Name = "View1"; store.TransactionManager.DoWithinTransaction(() => { this.authoredExtensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1"); this.view.ExtensionPoints.Add(this.authoredExtensionPoint); }); // Customize Toolkit var tailoredUriService = Mock.Of<IUriReferenceService>( u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p => p.ToolkitInfo.Identifier == "TailoredToolkit")); var tailoredPatternModel = PatternModelSpec.TailorPatternModel(authoredPatternModel, new Version("1.0.0.0"), "AuthoredToolkit"); store.TransactionManager.DoWithinTransaction(() => { tailoredPatternModel.Pattern.UriService = tailoredUriService; tailoredPatternModel.BaseId = "AuthoredToolkit"; }); this.tailoredExtensionPoint = tailoredPatternModel.Pattern.Views[0].ExtensionPoints[0]; }
public void InitializeContext() { var uriService = Mock.Of<IUriReferenceService>( u => u.ResolveUri<IInstanceBase>(It.IsAny<Uri>()) == Mock.Of<IProduct>(p => p.ToolkitInfo.Identifier == "AuthoredToolkit")); var store = new DslTestStore<PatternModelDomainModel>(); var serviceProvider = Mock.Get(store.ServiceProvider); serviceProvider.Setup(s => s.GetService(typeof(IPatternManager))).Returns( Mock.Of<IPatternManager>(p => p.InstalledToolkits == new List<IInstalledToolkitInfo>())); PatternModelSchema patternModel = null; store.TransactionManager.DoWithinTransaction(() => { patternModel = store.ElementFactory.CreateElement<PatternModelSchema>(); }); var patternSchema = patternModel.Create<PatternSchema>(); patternSchema.Name = "FooPattern"; patternSchema.PatternLink = "patternmanager://foo"; patternSchema.UriService = uriService; var view = patternSchema.Create<ViewSchema>(); view.Name = "View1"; store.TransactionManager.DoWithinTransaction(() => { var parentElement = store.ElementFactory.CreateElement<ElementSchema>("Element1"); this.element = store.ElementFactory.CreateElement<ElementSchema>("Element1"); this.extensionPoint = store.ElementFactory.CreateElement<ExtensionPointSchema>("ExtensionPoint1"); this.element.ExtensionPoints.Add(this.extensionPoint); parentElement.Elements.Add(element); view.Elements.Add(parentElement); }); }