public void Process_SiteSettingIsNotSet_SourcesAndTemplateAreNotSet(GetDatasourceLocationAndTemplateFromSite processor, Item renderingItem)
 {
   var args = new GetRenderingDatasourceArgs(renderingItem);
   processor.Process(args);
   args.DatasourceRoots.Count.Should().Be(0);
   args.Prototype.Should().BeNull();
 }
 public void Process_SiteSettingNameHasWrongFirmat_SourcesAndTemplateAreNotSet(GetDatasourceLocationAndTemplateFromSite processor, DbItem renderingItem, Db db, string settingName)
 {
   renderingItem.Add(new DbField("Datasource Location") { { "en", $"site:{settingName}" } });
   db.Add(renderingItem);
   var rendering = db.GetItem(renderingItem.ID);
   var args = new GetRenderingDatasourceArgs(rendering);
   processor.Process(args);
   args.DatasourceRoots.Count.Should().Be(0);
   args.Prototype.Should().BeNull();
 }
 public void Process_DatasourceProvidersAreNull_SourcesAndTemplateAreNotSet([Frozen]DatasourceProvider provider, GetDatasourceLocationAndTemplateFromSite processor, DbItem renderingItem, Db db, string settingName)
 {
   var setting = settingName.Replace("-", string.Empty);
   renderingItem.Add(new DbField("Datasource Location") { {"en", $"site:{setting}"} });
   db.Add(renderingItem);
   var rendering = db.GetItem(renderingItem.ID);
   var args = new GetRenderingDatasourceArgs(rendering);
   processor.Process(args);
   args.DatasourceRoots.Count.Should().Be(0);
   args.Prototype.Should().BeNull();
 }
 public void Process_DatasourceProviderIsNotNull_SourcesAndTemplateAreSet(IDatasourceProvider sourceProvider, [Substitute]DatasourceProviderFactory factory, DbItem renderingItem, Db db, string settingName, Item[] sources, Item sourceTemplate)
 {
   var processor  = new GetDatasourceLocationAndTemplateFromSite(factory);
   sourceProvider.GetDatasources(Arg.Any<string>(), Arg.Any<Item>()).Returns(sources);
   sourceProvider.GetDatasourceTemplate(Arg.Any<string>(), Arg.Any<Item>()).Returns(sourceTemplate);
   factory.GetProvider(Arg.Any<Database>()).Returns(sourceProvider);
   var setting = settingName.Replace("-", string.Empty);
   renderingItem.Add(new DbField("Datasource Location") { { "en", $"site:{setting}" } });
   db.Add(renderingItem);
   var rendering = db.GetItem(renderingItem.ID);
   var args = new GetRenderingDatasourceArgs(rendering);
   processor.Process(args);
   args.DatasourceRoots.Should().Contain(sources);
   args.Prototype.Should().Be(sourceTemplate);
 }