Пример #1
0
        private ObservableCollection <IPropertyBindingSettings> GetPropertySettings()
        {
            var properties = string.IsNullOrEmpty(this.Properties) ?
                             new ObservableCollection <IPropertyBindingSettings>() :
                             BindingSerializer.Deserialize <ObservableCollection <IPropertyBindingSettings> >(this.Properties);

            properties.CollectionChanged += (sender, args) =>
            {
                if (args.OldItems != null)
                {
                    args.OldItems.OfType <IPropertyBindingSettings>()
                    .ToList()
                    .ForEach(binding => binding.PropertyChanged -= OnSaveRules);
                }
                if (args.NewItems != null)
                {
                    args.NewItems.OfType <IPropertyBindingSettings>()
                    .ToList()
                    .ForEach(binding => binding.PropertyChanged += OnSaveRules);
                }
            };

            properties
            .ForEach(binding => binding.PropertyChanged += OnSaveRules);

            return(properties);
        }
Пример #2
0
            public void WhenChangingSavedValidatorBindingSettings_ThenPersistsChanges()
            {
                var settings = new ValidationBindingSettings
                {
                    TypeId     = "Foo",
                    Properties =
                    {
                        new PropertyBindingSettings
                        {
                            Name  = "Message",
                            Value = "Hello",
                        },
                        new PropertyBindingSettings
                        {
                            Name          = "From",
                            ValueProvider = new ValueProviderBindingSettings
                            {
                                TypeId = "CurrentUserProvider",
                            }
                        },
                    },
                };

                ((PropertySchema)this.property).RawValidationRules = BindingSerializer.Serialize <ValidationBindingSettings[]>(new ValidationBindingSettings[] { settings });

                ((BindingSettings)this.property.ValidationSettings.First()).Properties[0].Value = "World";
                ((BindingSettings)this.property.ValidationSettings.First()).Properties[1].ValueProvider.TypeId = "AnotherProvider";

                var saved = BindingSerializer.Deserialize <ValidationBindingSettings[]>(((PropertySchema)this.property).RawValidationRules);

                Assert.Equal(1, saved.Length);
                Assert.Equal("World", saved[0].Properties[0].Value);
                Assert.Equal("AnotherProvider", saved[0].Properties[1].ValueProvider.TypeId);
            }
Пример #3
0
        private void SetArtifactLink(UnfoldScope scope)
        {
            var container = scope.Automation.Owner;

            // Determine created item
            IItemContainer createdItem = null;

            createdItem = this.Solution.Find <IProject>(p => p.PhysicalPath == this.projectCreated).SingleOrDefault();
            if (createdItem == null)
            {
                createdItem = this.Solution.Find <IItem>(pi => pi.PhysicalPath == this.projectItemCreated).SingleOrDefault();
            }

            if (createdItem != null)
            {
                if (this.UriService.CanCreateUri <IItemContainer>(createdItem))
                {
                    // Set the artifact link
                    SolutionArtifactLinkReference
                    .SetReference(container, this.UriService.CreateUri <IItemContainer>(createdItem))
                    .Tag = BindingSerializer.Serialize(scope.ReferenceTag);
                }
                else
                {
                    tracer.Warn(Properties.Resources.InstantiationTemplateWizard_CantCreateUri, createdItem.GetLogicalPath());
                }
            }
        }
Пример #4
0
            public void WhenSettingValidatorBindingSettings_ThenPersistsChanges()
            {
                var settings = new ValidationBindingSettings
                {
                    TypeId     = "Foo",
                    Properties =
                    {
                        new PropertyBindingSettings
                        {
                            Name  = "Message",
                            Value = "Hello",
                        },
                        new PropertyBindingSettings
                        {
                            Name          = "From",
                            ValueProvider = new ValueProviderBindingSettings
                            {
                                TypeId = "CurrentUserProvider",
                            }
                        },
                    },
                };

                this.property.ValidationSettings = new IBindingSettings[] { settings };

                var saved = BindingSerializer.Deserialize <ValidationBindingSettings[]>(((PropertySchema)this.property).RawValidationRules);

                Assert.Equal(1, saved.Length);
                Assert.Equal("Foo", saved[0].TypeId);
                Assert.Equal(2, saved[0].Properties.Count);
                Assert.Equal("Message", saved[0].Properties[0].Name);
                Assert.Equal("Hello", saved[0].Properties[0].Value);
                Assert.Equal("From", saved[0].Properties[1].Name);
                Assert.Equal("CurrentUserProvider", saved[0].Properties[1].ValueProvider.TypeId);
            }
Пример #5
0
        /// <summary>
        /// Initializes the child element after it is created and added to the parent for the given item.
        /// </summary>
        protected override void InitializeCreatedElement(string itemId, IAbstractElement childElement)
        {
            Guard.NotNull(() => childElement, childElement);

            // Get the solution item for this imported file.
            var solutionItem = GetItemInSolution(itemId);

            if (solutionItem != null)
            {
                tracer.Info(
                    Resources.CreateElementFromFileCommand_TraceAddingReference, this.CurrentElement.InstanceName, childElement.InstanceName, solutionItem.GetLogicalPath());

                // Create artifact link
                var reference = SolutionArtifactLinkReference.AddReference(childElement, this.UriService.CreateUri(solutionItem));
                reference.AddTag(this.Tag);
                reference.AddTag(BindingSerializer.Serialize(new ReferenceTag
                {
                    SyncNames = this.SyncName
                }));
            }
            else
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                                  Resources.CreateElementFromFileCommand_ErrorNoSolutionItem, this.CurrentElement.InstanceName, childElement.InstanceName));
            }
        }
Пример #6
0
        private ConditionBindingSettings[] GetConditionSettings()
        {
            if (string.IsNullOrEmpty(this.Conditions))
            {
                return(new ConditionBindingSettings[0]);
            }

            return(BindingSerializer.Deserialize <ConditionBindingSettings[]>(this.Conditions));
        }
Пример #7
0
        private List <ConditionBindingSettings> GetConditionSettings()
        {
            if (string.IsNullOrEmpty(this.Conditions))
            {
                return(new List <ConditionBindingSettings>());
            }

            return(BindingSerializer.Deserialize <List <ConditionBindingSettings> >(this.Conditions));
        }
Пример #8
0
        private ValidationBindingSettings[] GetValidationSettings()
        {
            if (string.IsNullOrEmpty(this.ValidationRules))
            {
                return(new ValidationBindingSettings[0]);
            }

            return(BindingSerializer.Deserialize <ValidationBindingSettings[]>(this.ValidationRules));
        }
Пример #9
0
        /// <summary>
        /// Saves the <see cref="Collection{T}"/> instances as a serialized string.
        /// </summary>
        public override void SetValue(object component, object value)
        {
            var values = value as Collection <T>;

            if (values != null)
            {
                var serializedValue = values.Count == 0 ? null : BindingSerializer.Serialize(values);
                base.SetValue(component, serializedValue);
            }
        }
Пример #10
0
            public void WhenChangingValueProviderSettings_ThenPersistsChangesAutomatically()
            {
                var settings = this.property.ValueProvider;

                settings.TypeId = "Foo";

                var saved = BindingSerializer.Deserialize <IValueProviderBindingSettings>(this.property.RawValueProvider);

                Assert.Equal("Foo", saved.TypeId);
            }
Пример #11
0
            public void WhenChangingDefaultValueSettings_ThenPersistsChangesAutomatically()
            {
                var settings = (PropertyBindingSettings)this.property.DefaultValue;

                settings.Value = "hello";

                var saved = BindingSerializer.Deserialize <PropertyBindingSettings>(this.property.RawDefaultValue);

                Assert.Equal("hello", saved.Value);
            }
Пример #12
0
        private ValueProviderBindingSettings CreateValueProviderSettings()
        {
            var settings = string.IsNullOrEmpty(this.rawValueGetter()) ?
                           new ValueProviderBindingSettings() :
                           BindingSerializer.Deserialize <ValueProviderBindingSettings>(this.rawValueGetter());

            // Automatically serialize whenever something is changed in the binding.
            settings.PropertyChanged += OnSaveValue;

            return(settings);
        }
Пример #13
0
        private IBindingSettings[] GetValidationSettings()
        {
            if (string.IsNullOrEmpty(this.RawValidationRules))
            {
                return(new IBindingSettings[0]);
            }

            this.validationSettings = BindingSerializer.Deserialize <ValidationBindingSettings[]>(this.RawValidationRules);
            MonitorValidationRules();

            return(this.validationSettings);
        }
Пример #14
0
        /// <summary>
        /// Processes the document
        /// </summary>
        /// <param name="document">The document to process.</param>
        public void ProcessSchema(XDocument document)
        {
            Guard.NotNull(() => document, document);

            this.IsModified = false;

            // Locate all <commandSettings>
            var commandSettings = document.Descendants(CommandSettingsElementName)
                                  .Distinct();

            if (commandSettings.Any())
            {
                tracer.Info(Resources.CommandSettingsUpgradeProcessor_TraceDeserialize);

                // Enumerate each <commandSettings> element
                commandSettings.ForEach(cmdSettingsElement =>
                {
                    var id = cmdSettingsElement.Attribute(CommandSettingsIdName) != null ? cmdSettingsElement.Attribute(CommandSettingsIdName).Value : string.Empty;
                    var cmdPropsElement = cmdSettingsElement.Descendants(CommandSettingsPropertiesElementName).FirstOrDefault();
                    if (cmdPropsElement != null)
                    {
                        // Determine if has any <propertySettings>
                        var propSettingsElements = cmdPropsElement.Descendants(PropertySettingsElementName);
                        if (propSettingsElements.Any())
                        {
                            tracer.Info(Resources.CommandSettingsUpgradeProcessor_TraceDeserializeCommandSettings, id);

                            var bindings = new List <IPropertyBindingSettings>();
                            var processedPropertySettings = new List <XElement>();

                            // Enumerate each <propertySettings> element
                            propSettingsElements.ForEach(propSettingElement =>
                            {
                                // Ensure we have not already processed this <propertySettings> element
                                // (i.e. that it is not a nested <propertySettings> element)
                                if (!processedPropertySettings.Contains(propSettingElement))
                                {
                                    // Add to processed cache
                                    processedPropertySettings.Add(propSettingElement);

                                    // Create bindings
                                    AddPropertySettings(cmdPropsElement, bindings, propSettingElement, processedPropertySettings);
                                }
                            });

                            // Update value of <properties> element
                            cmdPropsElement.SetValue(BindingSerializer.Serialize <IEnumerable <IPropertyBindingSettings> >(bindings));
                            this.IsModified = true;
                        }
                    }
                });
            }
        }
Пример #15
0
        /// <summary>
        /// Gets the deserialized <see cref="Collection{T}"/> from the underlying serialized string.
        /// </summary>
        public override object GetValue(object component)
        {
            var value  = base.GetValue(component) as string;
            var values = string.IsNullOrEmpty(value) ? new Collection <T>() : BindingSerializer.Deserialize <Collection <T> >(value);

            if (this.IsReadOnly)
            {
                return(new ReadOnlyCollection <T>(values));
            }

            return(values);
        }
Пример #16
0
        private void UpdateReferenceTagTo1113()
        {
            var references = this.CurrentElement.References.Where(r => r.Tag == this.ReferenceTag);

            foreach (var reference in references)
            {
                reference.Tag = BindingSerializer.Serialize(new ReferenceTag {
                    SyncNames = true, TargetFileName = string.Empty
                });
            }
            this.ReferenceTag = string.Empty;
        }
Пример #17
0
 internal static ReferenceTag GetReference(string referenceTag)
 {
     try
     {
         return(BindingSerializer.Deserialize <ReferenceTag>(referenceTag));
     }
     catch
     {
         return(new ReferenceTag {
             SyncNames = false, TargetFileName = string.Empty
         });
     }
 }
        /// <summary>
        /// Saves the new instances as a serialized string.
        /// </summary>
        public override void SetValue(object component, object value)
        {
            var values = value as ICollection <object>;

            if (values != null)
            {
                var serializedValue = values.Count == 0 ? null : BindingSerializer.Serialize(values);
                var property        = GetPropertySettings(component);
                if (property != null)
                {
                    property.Value = serializedValue;
                }
            }
        }
Пример #19
0
        private static string GetSerializedLinkExistsCondition()
        {
            // Set the conditions
            var condition =
                new[]
            {
                new ConditionBindingSettings
                {
                    TypeId = typeof(ArtifactReferenceExistsCondition).FullName,
                }
            };

            return(BindingSerializer.Serialize(condition));
        }
Пример #20
0
        private static readonly string guidanceIconPath = ""; //"Resources/CommandShowGuidance.png";

        /// <summary>
        /// Ensures the associated commands and launchpoint automation are created and configured correctly.
        /// </summary>
        internal void EnsureGuidanceExtensionAutomation()
        {
            IPatternElementSchema element            = this.Extends as IPatternElementSchema;
            Func <bool>           existanceCondition = () => !string.IsNullOrEmpty(this.ExtensionId);

            // Configure the instantiate command, event.
            var instantiateCommand = element.EnsureCommandAutomation <InstantiateGuidanceWorkflowCommand>(Properties.Resources.GuidanceExtension_InstantiateCommandName,
                                                                                                          existanceCondition);

            if (instantiateCommand != null)
            {
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, string>(cmd => cmd.ExtensionId, this.ExtensionId);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, string>(cmd => cmd.DefaultInstanceName, this.GuidanceInstanceName);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, bool>(cmd => cmd.SharedInstance, this.GuidanceSharedInstance);
                instantiateCommand.SetPropertyValue <InstantiateGuidanceWorkflowCommand, bool>(cmd => cmd.ActivateOnInstantiation, this.GuidanceActivateOnCreation);
            }

            element.EnsureEventLaunchPoint <IOnElementInstantiatedEvent>(Properties.Resources.GuidanceExtension_InstantiateEventName,
                                                                         instantiateCommand, () => !String.IsNullOrEmpty(this.ExtensionId));

            // Configure the activate command and menu.
            var activateCommand = element.EnsureCommandAutomation <ActivateGuidanceWorkflowCommand>(Properties.Resources.GuidanceExtension_ActivateCommandName,
                                                                                                    existanceCondition);

            var activateMenu = element.EnsureMenuLaunchPoint(Resources.GuidanceExtension_ActivateContextMenuName,
                                                             activateCommand, Resources.GuidanceExtension_ActivateMenuItemText, guidanceIconPath,
                                                             existanceCondition);

            if (activateMenu != null)
            {
                // Set the conditions
                activateMenu.Conditions = BindingSerializer.Serialize(
                    new List <ConditionBindingSettings>
                {
                    new ConditionBindingSettings
                    {
                        TypeId     = typeof(ElementReferenceExistsCondition).FullName,
                        Properties =
                        {
                            new PropertyBindingSettings
                            {
                                Name  = Reflector <ElementReferenceExistsCondition> .GetPropertyName(cond => cond.Kind),
                                Value = ReferenceKindConstants.GuidanceTopic
                            },
                        }
                    }
                });
            }
        }
Пример #21
0
        /// <summary>
        /// Attemps to deserialize a <see cref="ReferenceTag"/> from a
        /// serialized string.
        /// </summary>
        /// <param name="serialized">The serialized reference tag.</param>
        /// <returns>The deserialized instance, or <see langword="null"/> if it can't be deserialized.</returns>
        public static ReferenceTag TryDeserialize(string serialized)
        {
            if (string.IsNullOrEmpty(serialized))
            {
                return(null);
            }

            try
            {
                return(BindingSerializer.Deserialize <ReferenceTag>(serialized));
            }
            catch
            {
                return(null);
            }
        }
Пример #22
0
            private IAutomationSettingsSchema AssertActivateContextMenu(bool verifySettings)
            {
                var menu = this.container.AutomationSettings.FirstOrDefault(set => set.Name.Equals(Properties.Resources.GuidanceExtension_ActivateContextMenuName));

                Assert.NotNull(menu);

                var menuSettings = menu.GetExtensions <MenuSettings>().FirstOrDefault();

                Assert.NotNull(menuSettings);

                if (verifySettings)
                {
                    Assert.Equal(CustomizationState.False, menu.IsCustomizable);
                    Assert.True(menu.IsSystem);

                    var command         = AssertActivateCommand(false);
                    var commandSettings = command.GetExtensions <ICommandSettings>().FirstOrDefault();

                    Assert.Equal(menuSettings.Text, Properties.Resources.GuidanceExtension_ActivateMenuItemText);
                    Assert.Equal(menuSettings.CommandId, commandSettings.Id);
                    Assert.Equal(menuSettings.WizardId, Guid.Empty);

                    var conditions = BindingSerializer.Serialize(
                        new[]
                    {
                        new ConditionBindingSettings
                        {
                            TypeId     = typeof(ElementReferenceExistsCondition).FullName,
                            Properties =
                            {
                                new PropertyBindingSettings
                                {
                                    Name  = Reflector <ElementReferenceExistsCondition> .GetPropertyName(cond => cond.Kind),
                                    Value = ReferenceKindConstants.GuidanceTopic
                                },
                            }
                        }
                    });

                    Assert.Equal(menuSettings.Conditions, conditions);
                }

                return(menu);
            }
Пример #23
0
 private static Guid GetIdFromReferenceTag(IReference r)
 {
     try
     {
         return(BindingSerializer.Deserialize <ReferenceTag>(r.Tag).Id);
     }
     catch
     {
         Guid result;
         if (Guid.TryParse(r.Tag, out result))
         {
             // Try to get the legacy settings guid
             return(result);
         }
         else
         {
             return(Guid.Empty);
         }
     }
 }
Пример #24
0
        public void WhenSerialingAnObjectWithAStringProperty_ThenItDeserializesItProperly()
        {
            var foos = new List <Foo> {
                new Foo {
                    Bar = 1, Baz = "Baz1"
                }, new Foo {
                    Bar = 2, Baz = "Baz2"
                }
            };

            var ser = BindingSerializer.Serialize(foos);

            var dserFoos = BindingSerializer.Deserialize <List <Foo> >(ser);

            Assert.Equal(dserFoos.Count, foos.Count);
            Assert.Equal(dserFoos.ElementAt(0).Bar, foos.ElementAt(0).Bar);
            Assert.Equal(dserFoos.ElementAt(0).Baz, foos.ElementAt(0).Baz);
            Assert.Equal(dserFoos.ElementAt(1).Bar, foos.ElementAt(1).Bar);
            Assert.Equal(dserFoos.ElementAt(1).Baz, foos.ElementAt(1).Baz);
        }
            public void WhenItemAlreadyExistsAndTargetFileNameHasExtension_ThenVsItemRenamedWithVerifiedName()
            {
                var projectItem = Mock.Get <EnvDTE.ProjectItem>(this.solutionItem.Object.As <EnvDTE.ProjectItem>());

                var          parent      = Mock.Get <IProject>(this.solutionItem.Object.Parent as IProject);
                Mock <IItem> anotherItem = new Mock <IItem>();

                anotherItem.Setup(i => i.Name).Returns(this.OwnerElement.Object.InstanceName + ".cs");
                parent.Setup(p => p.Items).Returns(new[] { solutionItem.Object, anotherItem.Object });


                var reference = Mock.Get <IReference>(this.OwnerElement.Object.References.First());

                reference.Setup(r => r.Tag).Returns(BindingSerializer.Serialize <ReferenceTag>(new ReferenceTag {
                    TargetFileName = "TestElementName1.cs"
                }));

                Command.Execute();

                projectItem.VerifySet(pi => pi.Name = "TestElementName1.cs", Times.Once());
            }
Пример #26
0
            public override void Initialize()
            {
                base.Initialize();

                this.status = new Mock <ICommandStatus>();

                this.bindingFactory = new Mock <IBindingFactory>();
                this.statusBinding  = new Mock <IDynamicBinding <ICommandStatus> >
                {
                    DefaultValue = DefaultValue.Mock
                };
                this.statusBinding.Setup(b => b.Value).Returns(this.status.Object);
                this.statusBinding.Setup(b => b.Evaluate(It.IsAny <IDynamicBindingContext>())).Returns(true);

                this.bindingFactory.Setup(f => f.CreateBinding <ICommandStatus>(It.IsAny <IBindingSettings>())).Returns(this.statusBinding.Object);
                this.Settings.Setup(x => x.CustomStatus).Returns(BindingSerializer.Serialize(new BindingSettings {
                    TypeId = "Foo"
                }));

                this.Automation.BindingFactory = this.bindingFactory.Object;
            }
            public void WhenSettingValue_ThenSerializesToJson()
            {
                var property = new Mock <PropertyDescriptor>("foo", new Attribute[0]);

                property.Setup(x => x.Name).Returns("Property");
                property.Setup(x => x.Attributes).Returns(new AttributeCollection());

                string serializedValue = null;

                property
                .Setup(x => x.SetValue(It.IsAny <object>(), It.IsAny <object>()))
                .Callback <object, object>((component, value) => serializedValue = (string)value);

                var descriptor = new StringCollectionPropertyDescriptor <Model>(property.Object);

                descriptor.SetValue(new object(), this.models);

                var conditions = BindingSerializer.Deserialize <Collection <Model> >(serializedValue);

                Assert.Equal(2, conditions.Count);
            }
Пример #28
0
        /// <summary>
        /// Finishes initialization, resolving the conditions and custom status bindings.
        /// </summary>
        public override void EndInit()
        {
            base.EndInit();

            if (this.BindingFactory != null)
            {
                try
                {
                    this.Conditions = this.Settings.ConditionSettings.Select(x => this.BindingFactory.CreateBinding <ICondition>(x)).ToArray();
                }
                catch (Exception e)
                {
                    tracer.Error(e, Resources.MenuAutomation_FailedToParseConditions, this.Name);
                    if (Microsoft.VisualStudio.ErrorHandler.IsCriticalException(e))
                    {
                        throw;
                    }
                }

                if (!string.IsNullOrEmpty(this.Settings.CustomStatus))
                {
                    try
                    {
                        var bindingSettings = BindingSerializer.Deserialize <BindingSettings>(this.Settings.CustomStatus);
                        if (!string.IsNullOrEmpty(bindingSettings.TypeId))
                        {
                            this.CommandStatus = this.BindingFactory.CreateBinding <ICommandStatus>(bindingSettings);
                        }
                    }
                    catch (Exception e)
                    {
                        tracer.Error(e, Resources.MenuAutomation_FailedToParseCustomStatus, this.Name);
                        if (Microsoft.VisualStudio.ErrorHandler.IsCriticalException(e))
                        {
                            throw;
                        }
                    }
                }
            }
        }
Пример #29
0
        public void WhenRoundTrippingFullBinding_ThenSucceeds()
        {
            IBindingSettings binding = new BindingSettings
            {
                TypeId     = "foo",
                Properties =
                {
                    new PropertyBindingSettings
                    {
                        Name          = "Name",
                        Value         = "Value",
                        ValueProvider = new ValueProviderBindingSettings
                        {
                            TypeId     = "ValueProvider",
                            Properties =
                            {
                                new PropertyBindingSettings
                                {
                                    Name  = "Id",
                                    Value = "1"
                                }
                            }
                        }
                    }
                }
            };

            var serialized   = BindingSerializer.Serialize(binding);
            var deserialized = BindingSerializer.Deserialize <IBindingSettings>(serialized);

            Assert.Equal(binding.TypeId, deserialized.TypeId);
            Assert.Equal(binding.Properties.Count, deserialized.Properties.Count);
            Assert.Equal(binding.Properties[0].Name, deserialized.Properties[0].Name);
            Assert.Equal(binding.Properties[0].Value, deserialized.Properties[0].Value);
            Assert.Equal(binding.Properties[0].ValueProvider.TypeId, deserialized.Properties[0].ValueProvider.TypeId);
            Assert.Equal(binding.Properties[0].ValueProvider.Properties[0].Name, deserialized.Properties[0].ValueProvider.Properties[0].Name);
            Assert.Equal(binding.Properties[0].ValueProvider.Properties[0].Value, deserialized.Properties[0].ValueProvider.Properties[0].Value);
        }
Пример #30
0
            private IAutomationSettingsSchema AssertSelectContextMenu(bool verifySettings)
            {
                var menu = this.container.AutomationSettings.FirstOrDefault(set => set.Name.Equals(Properties.Resources.ArtifactExtension_SelectContextMenuName));

                Assert.NotNull(menu);

                var menuSettings = menu.GetExtensions <MenuSettings>().FirstOrDefault();

                Assert.NotNull(menuSettings);

                if (verifySettings)
                {
                    Assert.Equal(CustomizationState.False, menu.IsCustomizable);
                    Assert.True(menu.IsSystem);

                    var command         = AssertSelectCommand(false);
                    var commandSettings = command.GetExtensions <ICommandSettings>().FirstOrDefault();

                    Assert.Equal(menuSettings.Text, Resources.ArtifactExtension_SelectMenuItemText);
                    Assert.Equal(menuSettings.CommandId, commandSettings.Id);
                    Assert.Equal(menuSettings.WizardId, Guid.Empty);

                    var conditions = BindingSerializer.Serialize(
                        new[]
                    {
                        new ConditionBindingSettings
                        {
                            TypeId = typeof(ArtifactReferenceExistsCondition).FullName,
                        }
                    });

                    Assert.Equal(menuSettings.Conditions, conditions);
                }

                return(menu);
            }