public void Initialise() { // Create mock objects _modelAssemblyProvider = new ModelAssemblyProvider(); _templateMappingProvider = new TemplateMapProvider(_modelAssemblyProvider); _spawnProvider = new SpawnProvider(_templateMappingProvider); }
/// <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(); }
public ItemWrapper(Item item, ISpawnProvider spawnProvider) { _spawnProvider = spawnProvider; _item = item; _fields = new Dictionary <string, IFieldWrapper>(); _lazyFields = new Dictionary <string, object>(); }
public FieldWrapper(string fieldName, string value, ISpawnProvider spawnProvider) { this.Name = fieldName; _value = value; SpawnProvider = spawnProvider; }
/// <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()); } }
/// <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); }
public FieldWrapper(Field field, ISpawnProvider spawnProvider) { Sitecore.Diagnostics.Assert.ArgumentNotNull(field, "field"); _modified = false; _field = field; SpawnProvider = spawnProvider; }
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); }
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; }
/// <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(); }
// 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); }
// 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; }
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 ItemWrapper(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider) : this(id, spawnProvider) { _lazyFields = lazyFields; }
public CallToActionListOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider) : base(parameters, spawnProvider) { }
public NumberFieldWrapper(Field field, ISpawnProvider spawnProvider) : base(field, spawnProvider) { }
public ContentPage(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider) : base(id, lazyFields, spawnProvider) { }
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; }
public OrderingOptions(Dictionary<string, string> parameters, ISpawnProvider spawnProvider) : base(parameters, spawnProvider) { }
public NavigationLink(ISpawnProvider spawnProvider) : base(null, spawnProvider) { }
public FileFieldWrapper(Field field, ISpawnProvider spawnProvider) : base(field, spawnProvider) { }
public NavigationLink(Guid id, ISpawnProvider spawnProvider) : base(id, spawnProvider) { }
public NavigationLink(Guid id, Dictionary<string, object> lazyFields, ISpawnProvider spawnProvider) : base(id, lazyFields, spawnProvider) { }
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) { }
/// <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) { }
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; }
public FieldWrapper(string value, ISpawnProvider spawnProvider) { _value = value; SpawnProvider = spawnProvider; }
public RenderingParameterWrapper(Dictionary<string, string> parameters, ISpawnProvider spawnProvider) { _parameters = parameters; SpawnProvider = spawnProvider; }
/// <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 ItemWrapper(ISpawnProvider spawnProvider) : this(null, spawnProvider) { }
public DateTimeFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null) : base(key, ref item, value, spawnProvider) { }
public ItemWrapper(Guid id, ISpawnProvider spawnProvider) : this(null, spawnProvider) { _itemId = id; }
public ContentPage(Item item, ISpawnProvider spawnProvider) : base(item, spawnProvider) { _item = item; }
public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null) : this(key, ref item, spawnProvider, (value ?? "").Split(_delimiter).ToGuidEnumerable()) { }
public HasMediaVideo(Item item, ISpawnProvider spawnProvider) : base(item, spawnProvider) { }
public ListFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, IEnumerable <Guid> ids = null) : base(key, ref item, ids.ToDelimitedString(_delimiter), spawnProvider) { _ids = ids; }
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; }
public MediaSiteExtension(Item item, ISpawnProvider spawnProvider) : base(item, spawnProvider) { }
public RulesFieldWrapper(string key, ref ItemWrapper item, ISpawnProvider spawnProvider, string value = null) : base(key, ref item, value, spawnProvider) { }
public MediaSiteExtension(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider) : base(id, lazyFields, spawnProvider) { }
public ContentPage(Guid id, ISpawnProvider spawnProvider) : base(id, spawnProvider) { }
public BackgroundType(Item item, ISpawnProvider spawnProvider) : base(item, spawnProvider) { }
public NumberFieldWrapper(string value, ISpawnProvider spawnProvider) : base(value, spawnProvider) { }
public BackgroundType(Guid id, Dictionary <string, object> lazyFields, ISpawnProvider spawnProvider) : base(id, lazyFields, spawnProvider) { }
public DateTimeFieldWrapper(Field field, ISpawnProvider spawnProvider) : base(field, spawnProvider) { }
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) { }