public void Initialise()
 {
     // Create mock objects
     _modelAssemblyProvider = new ModelAssemblyProvider();
     _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider);
     _spawnProvider = new SpawnProvider(_templateMappingProvider);
 }
Exemple #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();
        }
Exemple #3
0
 public ItemWrapper(Item item, ISpawnProvider spawnProvider)
 {
     _spawnProvider = spawnProvider;
     _item          = item;
     _fields        = new Dictionary <string, IFieldWrapper>();
     _lazyFields    = new Dictionary <string, object>();
 }
 public void Initialise()
 {
     // Create mock objects
     _modelAssemblyProvider   = new ModelAssemblyProvider();
     _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider);
     _spawnProvider           = new SpawnProvider(_templateMappingProvider);
 }
Exemple #5
0
        public FieldWrapper(string fieldName, string value, ISpawnProvider spawnProvider)
        {
            this.Name = fieldName;
            _value    = value;

            SpawnProvider = spawnProvider;
        }
Exemple #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());
            }
        }
Exemple #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());
            }
        }
Exemple #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);
        }
Exemple #9
0
        public FieldWrapper(Field field, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field");

            _modified = false;
            _field    = field;

            SpawnProvider = spawnProvider;
        }
Exemple #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);
 }
Exemple #11
0
        public FieldWrapper(Field field, ISpawnProvider spawnProvider)
        {
            Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field");

            _modified = false;
            _field = field;

            SpawnProvider = spawnProvider;
        }
Exemple #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;
        }
Exemple #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;
        }
Exemple #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();
        }
Exemple #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);
        }
Exemple #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;
        }
Exemple #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();
        }
        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();
        }
Exemple #19
0
 public ItemWrapper(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : this(id, spawnProvider)
 {
     _lazyFields = lazyFields;
 }
Exemple #20
0
 public CallToActionListOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
     : base(parameters, spawnProvider)
 {
 }
 public NumberFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Exemple #22
0
 public ContentPage(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Exemple #23
0
 public RulesFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
 public NumberFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, float value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Exemple #25
0
 public OrderingOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
     : base(parameters, spawnProvider)
 {
 }
Exemple #26
0
 public NavigationLink(ISpawnProvider spawnProvider)
     : base(null, spawnProvider)
 {
 }
Exemple #27
0
 public FileFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Exemple #28
0
 public NavigationLink(Guid id, ISpawnProvider spawnProvider)
     : base(id, spawnProvider)
 {
 }
Exemple #29
0
 public NavigationLink(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Exemple #30
0
 public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, IEnumerable ids = null)
     : this(key, ref item, spawnProvider, ids.ToGuidEnumerable())
 {
 }
 public IntegerFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
		public CustomItemFactory(IContextProvider contextProvider, ISpawnProvider spawnProvider) 
			: base(contextProvider, spawnProvider)
		{
		}
Exemple #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);
 }
 public BooleanFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Exemple #35
0
 public LinkFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
 public BooleanFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, bool value)
     : base(key, ref item, value ? "1" : "", spawnProvider)
 {
     _boolean = value;
 }
Exemple #37
0
        public FieldWrapper(string value, ISpawnProvider spawnProvider)
        {
            _value = value;

            SpawnProvider = spawnProvider;
        }
        public RenderingParameterWrapper(Dictionary<string, string> parameters, ISpawnProvider spawnProvider)
        {
            _parameters = parameters;

            SpawnProvider = spawnProvider;
        }
 public NumberFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, float value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Exemple #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;
 }
Exemple #41
0
 public ItemWrapper(ISpawnProvider spawnProvider)
     : this(null, spawnProvider)
 {
 }
 public DateTimeFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : base(key, ref item, value, spawnProvider)
 {
 }
Exemple #43
0
 public ItemWrapper(Guid id, ISpawnProvider spawnProvider)
     : this(null, spawnProvider)
 {
     _itemId = id;
 }
Exemple #44
0
 public ContentPage(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
     _item = item;
 }
Exemple #45
0
 public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : this(key, ref item, spawnProvider, (value ?? "").Split(_delimiter).ToGuidEnumerable())
 {
 }
Exemple #46
0
 public HasMediaVideo(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
Exemple #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;
 }
Exemple #48
0
 public HasMediaVideo(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
 public IntegerFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, long value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _value = value;
 }
Exemple #50
0
 public MediaSiteExtension(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
Exemple #51
0
 public RulesFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null)
     : base(key, ref item, value, spawnProvider)
 {
 }
Exemple #52
0
 public MediaSiteExtension(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
Exemple #53
0
 public ContentPage(Guid id, ISpawnProvider spawnProvider)
     : base(id, spawnProvider)
 {
 }
Exemple #54
0
 public BackgroundType(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
 }
 public NumberFieldWrapper(string value, ISpawnProvider spawnProvider)
     : base(value, spawnProvider)
 {
 }
Exemple #56
0
 public BackgroundType(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider)
     : base(id, lazyFields, spawnProvider)
 {
 }
 public DateTimeFieldWrapper(Field field, ISpawnProvider spawnProvider)
     : base(field, spawnProvider)
 {
 }
Exemple #58
0
 public NavigationLink(Item item, ISpawnProvider spawnProvider)
     : base(item, spawnProvider)
 {
     _item = item;
 }
 public DateTimeFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, DateTime value)
     : base(key, ref item, value.ToString(), spawnProvider)
 {
     _dateTime = value;
 }
 public BooleanFieldWrapper(string value, ISpawnProvider spawnProvider)
     : base(value, spawnProvider)
 {
 }