Ejemplo n.º 1
0
            public void WhenGettingStandardValuesForCommandReference_ThenRetrievesCommandSetting()
            {
                var context  = Mocks.Of <ITypeDescriptorContext>().First(c => c.Instance == this.settings.Object);
                var property =
                    new SettingsReferencePropertyDescriptor <IEventSettings, ICommandSettings>(
                        TypeDescriptor.GetProperties(typeof(IEventSettings))[this.settings.Object.GetPropertyName(x => x.CommandId)],
                        ev => ev.CommandId);

                var converter = property.Converter;

                Assert.True(converter.GetStandardValuesSupported(context));
                Assert.True(converter.GetStandardValuesExclusive(context));

                var values = converter.GetStandardValues(context);

                Assert.Equal(1, values.Count);
                Assert.Equal("CommandName", values.Cast <IAutomationSettings>().First().Name);
            }
Ejemplo n.º 2
0
            public void WhenGettingStandardValuesForCommandReference_ThenRetrievesCommandSetting()
            {
                var context = Mocks.Of<ITypeDescriptorContext>().First(c => c.Instance == this.settings.Object);
                var property =
                    new SettingsReferencePropertyDescriptor<IEventSettings, ICommandSettings>(
                        TypeDescriptor.GetProperties(typeof(IEventSettings))[this.settings.Object.GetPropertyName(x => x.CommandId)],
                        ev => ev.CommandId);

                var converter = property.Converter;

                Assert.True(converter.GetStandardValuesSupported(context));
                Assert.True(converter.GetStandardValuesExclusive(context));

                var values = converter.GetStandardValues(context);

                Assert.Equal(1, values.Count);
                Assert.Equal("CommandName", values.Cast<IAutomationSettings>().First().Name);
            }