Пример #1
0
        public PluginFamily(Type pluginType, PluginGraph parent)
        {
            _parent     = parent;
            _pluginType = pluginType;

            PluginFamilyAttribute.ConfigureFamily(this);
        }
        public void Do_not_add_a_memento_source_if_it_is_not_defined()
        {
            var mocks  = new MockRepository();
            var family = mocks.DynamicMock <IPluginFamily>();

            using (mocks.Record())
            {
                SetupResult.For(family.PluginType).Return(typeof(TypeThatDoesNotHaveCustomMementoSource));

                family.AddMementoSource(null);
                LastCall.Repeat.Never();
            }

            using (mocks.Playback())
            {
                PluginFamilyAttribute.ConfigureFamily(family);
            }
        }
        public void CreateMemoryMementoSourceWhenTheMementoSourceIsExplicitlyDefinedInAttribute()
        {
            var mocks  = new MockRepository();
            var family = mocks.DynamicMock <IPluginFamily>();

            using (mocks.Record())
            {
                SetupResult.For(family.PluginType).Return(typeof(TypeWithDesignatedMementoSource));

                family.AddMementoSource(null);
                LastCall.Constraints(Is.TypeOf <CustomMementoSource>());
            }

            using (mocks.Playback())
            {
                PluginFamilyAttribute.ConfigureFamily(family);
            }
        }