public override void establish_context() { model = new PersistenceModel(); var comp_map = new ComponentMap <ComponentTarget>(); comp_map.Map(x => x.Property); comp_map.Component(x => x.Component) .ColumnPrefix(second_prefix); model.Add(comp_map); var comp2_map = new ComponentMap <Child>(); comp2_map.Map(x => x.Property); model.Add(comp2_map); var map = new ClassMap <Target>(); map.Id(x => x.Id); map.Component(x => x.Component) .ColumnPrefix(first_prefix); model.Add(map); }
public void WeCanReadTheConfigurationSection() { TypeResolver obj = (TypeResolver)ConfigurationManager.GetSection("PressPlay/FFWD"); Assert.That(obj, Is.Not.Null); Assert.That(obj, Is.InstanceOf <TypeResolver>()); Assert.That(obj.ExcludeByDefault, Is.True); Assert.That(obj.DefaultNamespace, Is.EqualTo("PressPlay.FFWD")); Assert.That(obj.NamespaceRules, Is.Not.Null); Assert.That(obj.NamespaceRules, Is.Not.Empty); Assert.That(obj.NamespaceRules[0].Namespace, Is.EqualTo("System")); Assert.That(obj.NamespaceRules[0].To, Is.EqualTo("Testing")); Assert.That(obj.ComponentWriters, Is.Not.Null); Assert.That(obj.ComponentWriters, Is.Not.Empty); ComponentMap map = obj.ComponentWriters.Find(m => m.Type == "UnityEngine.MeshRenderer"); Assert.That(map, Is.Not.Null); Assert.That(map.To, Is.StringStarting(typeof(MeshRendererWriter).FullName)); Assert.That(map.FilterType, Is.EqualTo(Filter.FilterType.None)); map = obj.ComponentWriters.Find(m => m.Type == "AnimatedCheckPoint"); Assert.That(map, Is.Not.Null); Assert.That(map.FilterType, Is.EqualTo(Filter.FilterType.Exclude)); Assert.That(map.FilterItems, Is.EqualTo("sndActivate,challenge")); }
protected ServerContextBase(ISerializer serializer) { Serializer = serializer; OperationMap = new OperationMap(); OperationsComponentMap = new ComponentMap(); }
public Environment(IConnection conn, IDispatcher dispatch) { Connection = conn; Dispatcher = dispatch; Walkers = new ComponentMap <Path>(dispatch); Positions = new ComponentMap <Position>(dispatch); }
public void ShouldAutomapComponent() { var componentMap = new ComponentMap(); var mappedComponent = componentMap.AutomapComponent(typeof(TestComponent)); componentMap.MappedComponents.ShouldContain(mappedComponent); mappedComponent.MappedMethods.Any(t => t.MethodInfo == typeof(TestComponent).GetMethod("PublicMethod")).ShouldBeTrue(); }
public void ShouldAutomapAssembly() { var componentMap = new ComponentMap(); componentMap.AutomapAssembly(typeof(ComponentMapTests).Assembly, t => t == typeof(TestComponent)); componentMap.MappedComponents.Any(t => t.ComponentType == typeof(TestComponent)).ShouldBeTrue(); }
/// <summary> /// Creates a copy of the current instance. /// </summary> /// <returns>The copied <see cref="AtataAttributesContext"/> instance.</returns> public AtataAttributesContext Clone() { return(new AtataAttributesContext( new List <Attribute>(Global), AssemblyMap.ToDictionary(x => x.Key, x => x.Value.ToList()), ComponentMap.ToDictionary(x => x.Key, x => x.Value.ToList()), PropertyMap.ToDictionary(x => x.Key, x => x.Value.ToList()))); }
public void ShouldGetMethodByType() { var componentMap = new ComponentMap(); var mappedComponent = componentMap.MapComponent(0, typeof(TestComponent)); var foundComponent = componentMap.GetComponent(typeof(TestComponent)); foundComponent.ShouldBe(mappedComponent); }
public virtual void SetFields(Item importItem, Item datasource, ComponentMap cm, SitecoreDataMap sitecoreMap) { datasource.Editing.BeginEdit(); foreach (var kvp in cm.Fields) { kvp.Value.FillField(sitecoreMap, ref datasource, importItem); } datasource.Editing.EndEdit(false, false); datasource.Database.Caches.ItemCache.RemoveItem(datasource.ID); }
public void ShouldThrowWhenMappingDuplicateIds() { var componentMap = new ComponentMap(); componentMap.MapComponent(0, typeof(TestComponent)); Action action = () => componentMap.MapComponent(0, typeof(TestComponent)); action.ShouldThrow <ArgumentException>(); }
public void ShouldMapComponent() { var componentMap = new ComponentMap(); var mappedComponent = componentMap.MapComponent(0, typeof(TestComponent)); componentMap.MappedComponents.ShouldContain(mappedComponent); mappedComponent.Id.ShouldBe((byte)0); mappedComponent.ComponentType.ShouldBe(typeof(TestComponent)); }
public override void establish_context() { inline_component = new ClassMap <Target>(); inline_component.Component(x => x.ComponentProperty, c => c.Map(x => x.Property)); external_component = new ComponentMap <Component>(); external_component.Map(x => x.Property); reference_component = new ClassMap <Target>(); reference_component.Component(x => x.ComponentProperty); }
public override void establish_context() { inline_component = new ClassMap<Target>(); inline_component.Component(x => x.ComponentProperty, c => c.Map(x => x.Property)); external_component = new ComponentMap<Component>(); external_component.Map(x => x.Property); reference_component = new ClassMap<Target>(); reference_component.Component(x => x.ComponentProperty); }
public override void establish_context() { var component_map = new ComponentMap<Component>(); component_map.Map(x => x.Property); var class_map = new ClassMap<Target>(); class_map.Component(x => x.Component); persistence_model = new PersistenceModel(); persistence_model.Add(class_map); persistence_model.Add(component_map); }
public void Initialize() { context = new FileContext("test", new MemoryStream()); sectionContextStub = new SectionContextStub(context); childTargetMapMock = new Mock<IClassMap<ChildTarget,FileContext>>(); childTargetMapMock.Setup(m => m.ExtractAsync(It.IsAny<FileContext>(), It.IsAny<ChildTarget>())) .Returns(Task.Delay(0)); parentTarget = new ParentTarget(); childTargets = new[] { new ChildTarget(), new ChildTarget() }; endOfSectionPredicate = c => false; map = new ComponentMap<ParentTarget, ChildTarget, FileContext>(p => p.Children, c => sectionContextStub, () => childTargets[childIndex++], childTargetMapMock.Object, c => endOfSectionPredicate(c)); }
public override void establish_context() { model = new PersistenceModel(); var comp_map = new ComponentMap<ComponentTarget>(); comp_map.Map(x => x.Property); model.Add(comp_map); var map = new ClassMap<Target>(); map.Id(x => x.Id); map.Component(x => x.Component) .ColumnPrefix(column_prefix); model.Add(map); }
public void Setup() { var mockDispatcher = new Mock <IDispatcher>(); mockDispatcher.Setup(_ => _.OnAddComponent(It.IsAny <Action <AddComponentOp <Position> > >())) .Callback <Action <AddComponentOp <Position> > >(callback => _addComponentCallback = callback); mockDispatcher.Setup(_ => _.OnAuthorityChange <Position>(It.IsAny <Action <AuthorityChangeOp> >())) .Callback <Action <AuthorityChangeOp> >(callback => _setAuthorityCallback = callback); mockDispatcher.Setup(_ => _.OnComponentUpdate(It.IsAny <Action <ComponentUpdateOp <Position> > >())) .Callback <Action <ComponentUpdateOp <Position> > >(callback => _updateComponentCallback = callback); mockDispatcher.Setup(_ => _.OnRemoveEntity(It.IsAny <Action <RemoveEntityOp> >())) .Callback <Action <RemoveEntityOp> >(callback => _removeEntityCallback = callback); _componentMap = new ComponentMap <Position>(mockDispatcher.Object); }
public override void establish_context() { model = new PersistenceModel(); var componentMap = new ComponentMap <FieldComponent>(); componentMap.Map(x => x.X); componentMap.Map(x => x.Y); model.Add(componentMap); var classMapping = new ClassMap <Root>(); classMapping.Id(r => r.Id); classMapping.Component(Reveal.Member <Root, FieldComponent>("component"), cpt => cpt.Access.Field().ColumnPrefix(columnPrefix)); model.Add(classMapping); }
public override void establish_context() { model = new PersistenceModel(); var comp_map = new ComponentMap <ComponentTarget>(); comp_map.Map(x => x.Property); comp_map.HasMany(x => x.Children); comp_map.Component(x => x.Component, c => c.Map(x => x.Property)); model.Add(comp_map); var map = new ClassMap <Target>(); map.Id(x => x.Id); map.Component(x => x.Component) .ColumnPrefix(column_prefix); model.Add(map); }
public Game1() { this._graphics = new GraphicsDeviceManager(this); this.Content.RootDirectory = "Content"; this.Window.Title = "Move on map 3d"; this.IsMouseVisible = true; this._componentInputs = new ComponentInputs(this); this._componentInputs.UpdateOrder = 1; this.Components.Add(this._componentInputs); this._componentMap = new ComponentMap(this, this._componentInputs); this._componentMap.UpdateOrder = 2; this.Components.Add(this._componentMap); this._componentRender = new ComponentRender(this, this._componentMap); this._componentRender.UpdateOrder = 3; this.Components.Add(this._componentRender); }
public MultilistToComponents(Item i, ILogger l) : base(i, l) { ExistingDataNames = GetItemField(i, "From What Field").Split(comSplitr, StringSplitOptions.RemoveEmptyEntries); Delimiter = GetItemField(i, "Delimiter"); Device = GetItemField(i, "Device"); DatasourceFolder = GetItemField(i, "Datasource Folder"); IsSXA = GetItemField(i, "Is SXA") == "1"; PresentationService = new PresentationService(l); ComponentMaps = new Dictionary <string, ComponentMap>(); MediaService = new MediaService(l); var maps = InnerItem.GetChildren(); foreach (Item m in maps) { var c = new ComponentMap { FromWhatTemplate = GetItemField(m, "From What Template"), Component = GetItemField(m, "Component"), Placeholder = GetItemField(m, "Placeholder"), DatasourcePath = GetItemField(m, "Datasource Path"), OverwriteExisting = GetItemField(m, "Overwrite Existing") == "1", Fields = new Dictionary <string, IBaseField>(), Parameters = GetItemField(m, "Parameters") }; foreach (Item f in m.GetChildren()) { var bf = FieldService.BuildBaseField(f); var a = GetItemField(f, "From What Field"); if (string.IsNullOrWhiteSpace(a) || bf == null) { continue; } c.Fields.Add(a, bf); } ComponentMaps.Add(c.FromWhatTemplate, c); } }
public static NodeComponent FromXml(XElement component) { Type T; if (ComponentMap.TryGetValue(component.Element("ComponentName").Value, out T)) { Object o = Activator.CreateInstance(T); if (!(o is NodeComponent)) { throw new Exception("Attempt to deserialize XML failed. Object of type " + o.GetType().Name + " could not be cast to NodeComponent"); } if (ComponentFields.ContainsKey(T)) { // for each Property element in xml, try to find the matching component variable foreach (XElement p in component.Elements("Property")) { foreach (FieldInfo fi in ComponentFields[T]) { if (p.Element("Key").Value == fi.Name) { fi.SetValue(o, p.Element("Value").Value); } } } } if (component.Element("ComponentNodeLink") != null) { (o as NodeComponent).nodeLinks = component .Elements("ComponentNodeLink") .Select(e => new ComponentNodeLink(e)) .ToList(); } return(o as NodeComponent); } else { throw new Exception("Attempt to deserialize XML failed. Component of type " + component.Element("ComponentName").Value + " could not be found in component map"); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ComponentMap obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
public CameraView(Game game, ComponentMap componentMap) { this._game = game; this._componentContent = componentMap; }
public void PreventTooManyComponents() { map = new ComponentMap(1); // Construct a map where only one component is allowed map.Register <A>(); map.Register <B>(); // Registering 2 component should throw an exception }
public void Setup() { map = new ComponentMap(); }
public ComponentRender(Game game, ComponentMap componentContent) : base(game) { this._cameraView = new CameraView(game, componentContent); this._cameraView.Initialize(); }
public void ArgumentConstructor() { map = new ComponentMap(3); Assert.AreEqual(map.Size, 0); Assert.AreEqual(map.MaximumSize, (uint)3); }
public override void establish_context() { component = new ComponentMap<Target>(); component.Map(x => x.a_property); component.ReferencesAny(x => x.an_any).EntityIdentifierColumn("x").EntityTypeColumn("y").IdentityType(typeof(Target)); component.HasMany(x => x.a_collection); component.Component(x => x.a_component); component.HasOne(x => x.a_one_to_one); component.References(x => x.a_reference); }
public override void establish_context() { model = new PersistenceModel(); var componentMap = new ComponentMap<FieldComponent>(); componentMap.Map(x => x.X); componentMap.Map(x => x.Y); model.Add(componentMap); var classMapping = new ClassMap<Root>(); classMapping.Id(r => r.Id); classMapping.Component(Reveal.Member<Root, FieldComponent>("component"), cpt => cpt.Access.Field().ColumnPrefix(columnPrefix)); model.Add(classMapping); }
public static void MapComponentWithPrefix <T, TComponent>(this ComponentMap <T> map, Expression <Func <T, TComponent> > f) { map.Component(f).ColumnPrefix(MemberUtility.GetMemberInfo(f).Name); }