Ejemplo n.º 1
0
 public void Initialise()
 {
     // Create mock objects
     _modelAssemblyProvider = new ModelAssemblyProvider();
     _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider);
     _spawnProvider = new SpawnProvider(_templateMappingProvider);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialise Fortis with a spawn provider and item factory and verifies the initialisation.
        /// </summary>
        /// <param name="spawnProvider"></param>
        /// <param name="itemFactory"></param>
        public static void Initialise(ISpawnProvider spawnProvider, IItemFactory itemFactory)
        {
            SpawnProvider = spawnProvider;
            ItemFactory = itemFactory;

            Verify();
        }
Ejemplo n.º 3
0
 public ItemWrapper(Item item, ISpawnProvider spawnProvider)
 {
     _spawnProvider = spawnProvider;
     _item          = item;
     _fields        = new Dictionary <string, IFieldWrapper>();
     _lazyFields    = new Dictionary <string, object>();
 }
Ejemplo n.º 4
0
 public void Initialise()
 {
     // Create mock objects
     _modelAssemblyProvider   = new ModelAssemblyProvider();
     _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider);
     _spawnProvider           = new SpawnProvider(_templateMappingProvider);
 }
Ejemplo n.º 5
0
        public FieldWrapper(string fieldName, string value, ISpawnProvider spawnProvider)
        {
            this.Name = fieldName;
            _value    = value;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Verifies that Fortis has been correctly set up.
        /// </summary>
        /// <param name="itemFactory"></param>
        /// <param name="spawnProvider"></param>
        /// <param name="itemSearchFactory"></param>
        public static void Verify(IItemFactory itemFactory, ISpawnProvider spawnProvider, IItemSearchFactory itemSearchFactory)
        {
            var verificationFailed = false;
            var errorMessages      = new StringBuilder();

            errorMessages.AppendLine("Fortis intialise verification failed:");
            errorMessages.AppendLine();

            if (!VerifySpawnProvider(spawnProvider))
            {
                errorMessages.AppendLine("SpawnProvider is not initialised");
                verificationFailed = true;
            }

            if (!VerifyItemFactory(itemFactory))
            {
                errorMessages.AppendLine("ItemFactory is not initialised");
                verificationFailed = true;
            }

            if (!VerifyItemSearchFactory(itemSearchFactory))
            {
                errorMessages.AppendLine("ItemSearchFactory is not initialised");
                verificationFailed = true;
            }

            if (verificationFailed)
            {
                throw new Exception(errorMessages.ToString());
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Verifies that Fortis has been correctly set up.
        /// </summary>
        /// <param name="itemFactory"></param>
        /// <param name="spawnProvider"></param>
        /// <param name="itemSearchFactory"></param>
        public static void Verify(IItemFactory itemFactory, ISpawnProvider spawnProvider, IItemSearchFactory itemSearchFactory)
        {
            var verificationFailed = false;
            var errorMessages = new StringBuilder();

            errorMessages.AppendLine("Fortis intialise verification failed:");
            errorMessages.AppendLine();

            if (!VerifySpawnProvider(spawnProvider))
            {
                errorMessages.AppendLine("SpawnProvider is not initialised");
                verificationFailed = true;
            }

            if (!VerifyItemFactory(itemFactory))
            {
                errorMessages.AppendLine("ItemFactory is not initialised");
                verificationFailed = true;
            }

            if (!VerifyItemSearchFactory(itemSearchFactory))
            {
                errorMessages.AppendLine("ItemSearchFactory is not initialised");
                verificationFailed = true;
            }

            if (verificationFailed)
            {
                throw new Exception(errorMessages.ToString());
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Initialise Fortis with a spawn provider and item factory and verifies the initialisation.
        /// </summary>
        /// <param name="spawnProvider"></param>
        /// <param name="itemFactory"></param>
        public static void Initialise(ISpawnProvider spawnProvider, IItemFactory itemFactory, IItemSearchFactory itemSearchFactory)
        {
            SpawnProvider     = spawnProvider;
            ItemFactory       = itemFactory;
            ItemSearchFactory = itemSearchFactory;

            Verify(ItemFactory, SpawnProvider, ItemSearchFactory);
        }
Ejemplo n.º 9
0
        public FieldWrapper(Field field, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field");

            _modified = false;
            _field    = field;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 10
0
 public void Initialise()
 {
     // Create mock objects
     _mockContextProvider     = new Mock <IContextProvider>();
     _modelAssemblyProvider   = new ModelAssemblyProvider();
     _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider);
     _spawnProvider           = new SpawnProvider(_templateMappingProvider);
     _itemFactory             = new ItemFactory(_mockContextProvider.Object, _spawnProvider);
 }
Ejemplo n.º 11
0
        public FieldWrapper(Field field, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field");

            _modified = false;
            _field = field;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 12
0
        public FieldWrapper(string key, ref ItemWrapper item, string value, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(key, "key");
            Sitecore.Diagnostics.Assert.ArgumentNotNull(item, "item");

            _key = key;
            _item = item;
            _rawValue = value;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 13
0
        public FieldWrapper(string key, ref ItemWrapper item, string value, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(key, "key");
            Sitecore.Diagnostics.Assert.ArgumentNotNull(item, "item");

            _key      = key;
            _item     = item;
            _rawValue = value;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Initialise a default Fortis setup with a context provider and verifies the initialisation.
        /// </summary>
        /// <param name="contextProvider"></param>
        public static void Initialise(IContextProvider contextProvider)
        {
            SpawnProvider = new SpawnProvider(
                                    new TemplateMapProvider(
                                            new ModelAssemblyProvider()
                                        )
                                );

            ItemFactory = new ItemFactory(contextProvider, SpawnProvider);

            Verify();
        }
Ejemplo n.º 15
0
        // test fixture setup
        protected FieldWrapperTestClass()
        {
            this.SpawnProvider = Substitute.For <ISpawnProvider>();

            // Construct test item.
            this.Db = new Db();
            var item = new DbItem("Test", ID.NewID);

            this.Field = new DbField(FieldName, ID.NewID);
            item.Fields.Add(this.Field);
            this.Db.Add(item);
        }
Ejemplo n.º 16
0
        // test fixture setup
        protected FieldWrapperTestClass()
        {
            this.SpawnProvider = Substitute.For <ISpawnProvider>();

            // Construct test item.
            this.Db = new Db();
            var item = new DbItem("Test", ID.NewID);

            this.Field = new DbField(FieldName, ID.NewID);
            item.Fields.Add(this.Field);
            this.Db.Add(item);

            // init sitecore context
            Sitecore.Context.Site = new FakeSiteContext("website");
            Sitecore.Context.Item = this.Item;
        }
Ejemplo n.º 17
0
        public NameValueListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, ArrayList value = null)
            : base(key, ref item, string.Empty, spawnProvider)
        {
            if (value == null)
            {
                return;
            }

            _value = new NameValueCollection();
            foreach (object val in value)
            {
                if (val is ArrayList)
                {
                    var tmp = val as ArrayList;
                    _value.Add(tmp[0].ToString(), tmp[1].ToString());
                }
            }

            this._rawValue = _value.ToString();
        }
Ejemplo n.º 18
0
        public NameValueListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, ArrayList value = null)
            : base(key, ref item, string.Empty, spawnProvider)
        {
            if (value == null)
            {
                return;
            }

            _value = new NameValueCollection();
            foreach (object val in value)
            {
                if (val is ArrayList)
                {
                    var tmp = val as ArrayList;
                    _value.Add(tmp[0].ToString(), tmp[1].ToString());
                }
            }

            this._rawValue = _value.ToString();
        }
Ejemplo n.º 19
0
 public ItemWrapper(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : this(id, spawnProvider)
 {
     _lazyFields = lazyFields;
 }
Ejemplo n.º 20
0
 public CallToActionListOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
     : base(parameters, spawnProvider)
 {
 }
Ejemplo n.º 21
0
 public NumberFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 22
0
 public ContentPage(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Ejemplo n.º 23
0
 public RulesFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 24
0
 public NumberFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, float value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Ejemplo n.º 25
0
 public OrderingOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
     : base(parameters, spawnProvider)
 {
 }
Ejemplo n.º 26
0
 public NavigationLink(ISpawnProvider spawnProvider)
     : base(null, spawnProvider)
 {
 }
Ejemplo n.º 27
0
 public FileFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 28
0
 public NavigationLink(Guid id, ISpawnProvider spawnProvider)
     : base(id, spawnProvider)
 {
 }
Ejemplo n.º 29
0
 public NavigationLink(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Ejemplo n.º 30
0
 public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, IEnumerable ids = null)
     : this(key, ref item, spawnProvider, ids.ToGuidEnumerable())
 {
 }
Ejemplo n.º 31
0
 public IntegerFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
		public CustomItemFactory(IContextProvider contextProvider, ISpawnProvider spawnProvider) 
			: base(contextProvider, spawnProvider)
		{
		}
Ejemplo n.º 33
0
 /// <summary>
 /// Verifies the spawn provider is correctly set up.
 /// </summary>
 /// <param name="spawnProvider"></param>
 /// <returns></returns>
 public static bool VerifySpawnProvider(ISpawnProvider spawnProvider)
 {
     return(spawnProvider != null && spawnProvider.TemplateMapProvider != null);
 }
Ejemplo n.º 34
0
 public BooleanFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 35
0
 public LinkFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 36
0
 public BooleanFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, bool value)
     : base(key, ref item, value ? "1" : "", spawnProvider)
 {
     _boolean = value;
 }
Ejemplo n.º 37
0
        public FieldWrapper(string value, ISpawnProvider spawnProvider)
        {
            _value = value;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 38
0
        public RenderingParameterWrapper(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
        {
            _parameters = parameters;

            SpawnProvider = spawnProvider;
        }
Ejemplo n.º 39
0
 public NumberFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, float value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Verifies the spawn provider is correctly set up.
 /// </summary>
 /// <param name="spawnProvider"></param>
 /// <returns></returns>
 public static bool VerifySpawnProvider(ISpawnProvider spawnProvider)
 {
     return spawnProvider != null && spawnProvider.TemplateMapProvider != null;
 }
Ejemplo n.º 41
0
 public ItemWrapper(ISpawnProvider spawnProvider)
     : this(null, spawnProvider)
 {
 }
Ejemplo n.º 42
0
 public DateTimeFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : base(key, ref item, value, spawnProvider)
 {
 }
Ejemplo n.º 43
0
 public ItemWrapper(Guid id, ISpawnProvider spawnProvider)
     : this(null, spawnProvider)
 {
     _itemId = id;
 }
Ejemplo n.º 44
0
 public ContentPage(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
     _item = item;
 }
Ejemplo n.º 45
0
 public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : this(key, ref item, spawnProvider, (value ?? "").Split(_delimiter).ToGuidEnumerable())
 {
 }
Ejemplo n.º 46
0
 public HasMediaVideo(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
Ejemplo n.º 47
0
 public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, IEnumerable <Guid> ids = null)
     : base(key, ref item, ids.ToDelimitedString(_delimiter), spawnProvider)
 {
     _ids = ids;
 }
Ejemplo n.º 48
0
 public HasMediaVideo(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Ejemplo n.º 49
0
 public IntegerFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, long value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Ejemplo n.º 50
0
 public MediaSiteExtension(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
Ejemplo n.º 51
0
 public RulesFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : base(key, ref item, value, spawnProvider)
 {
 }
Ejemplo n.º 52
0
 public MediaSiteExtension(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Ejemplo n.º 53
0
 public ContentPage(Guid id, ISpawnProvider spawnProvider)
     : base(id, spawnProvider)
 {
 }
Ejemplo n.º 54
0
 public BackgroundType(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
Ejemplo n.º 55
0
 public NumberFieldWrapper(string value, ISpawnProvider spawnProvider)
     : base(value, spawnProvider)
 {
 }
Ejemplo n.º 56
0
 public BackgroundType(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Ejemplo n.º 57
0
 public DateTimeFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Ejemplo n.º 58
0
 public NavigationLink(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
     _item = item;
 }
Ejemplo n.º 59
0
 public DateTimeFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, DateTime value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _dateTime = value;
 }
Ejemplo n.º 60
0
 public BooleanFieldWrapper(string value, ISpawnProvider spawnProvider)
     : base(value, spawnProvider)
 {
 }