public void EditValue_WithCurrentItemInAvailableItems_ReturnsCurrentItem() { // Setup var simpleStructure = new TestStructure(); var properties = new ObjectPropertiesWithStructure(simpleStructure, new[] { simpleStructure }); var propertyBag = new DynamicPropertyBag(properties); var editor = new StructureEditor <TestStructure>(); var someValue = new object(); var serviceProvider = mockRepository.Stub <IServiceProvider>(); var service = mockRepository.Stub <IWindowsFormsEditorService>(); var descriptorContext = mockRepository.Stub <ITypeDescriptorContext>(); serviceProvider.Stub(p => p.GetService(null)).IgnoreArguments().Return(service); descriptorContext.Stub(c => c.Instance).Return(propertyBag); mockRepository.ReplayAll(); // Call object result = editor.EditValue(descriptorContext, serviceProvider, someValue); // Assert Assert.AreSame(simpleStructure, result); mockRepository.VerifyAll(); }
public override void Draw(SpriteBatch spriteBatch) { Rectangle effectiveBounds = GetEffectiveBounds(); if (effectiveBounds.IsEmpty) { return; } if (selected) { Rectangle effectiveOutline = Rectangle.Intersect(outlineRect, parent.GetEffectiveBounds()); spriteBatch.Draw(pixel, effectiveOutline, effectiveOutline, outlineColor); spriteBatch.Draw(pixel, effectiveBounds, backgroundColor); } Rectangle effectiveBlock = new Rectangle(effectiveBounds.Location - bounds.Location, effectiveBounds.Size); block.DrawSimple(spriteBatch, ConvertUtils.PointToVector2(bounds.Location), scale, effectiveBlock); if (hovered) { StructureEditor.SetTooltip(block.displayName); } }
public void DefaultConstructor_ReturnsNewInstance() { // Call var editor = new StructureEditor <TestStructure>(); // Assert Assert.IsInstanceOf <SelectionEditor <IHasStructureProperty <TestStructure>, TestStructure> >(editor); }