public void GetEnumerator_Call_ReturnScoresWithKeyName(Db db, ID keyId1, ID keyId2, DbItem profileItem, IBehaviorProfileContext behaviorProfile) { //Arrange using (new SecurityDisabler()) { profileItem.Add(new DbItem("Key1", keyId1, ProfileKeyItem.TemplateID) { { ProfileKeyItem.FieldIDs.NameField, "key1name" } }); profileItem.Add(new DbItem("Key2", keyId2, ProfileKeyItem.TemplateID) { { ProfileKeyItem.FieldIDs.NameField, "key2name" } }); db.Add(profileItem); var item = db.GetItem(profileItem.FullPath); var profile = new ProfileItem(item); var behaviorScores = new List <KeyValuePair <ID, float> >() { new KeyValuePair <ID, float>(keyId1, 10), new KeyValuePair <ID, float>(keyId2, 20) }; behaviorProfile.Scores.Returns(behaviorScores); var behaviorProfileDecorator = new BehaviorProfileDecorator(profile, behaviorProfile); //Act var result = behaviorProfileDecorator.ToList(); //Assert result.Should().BeEquivalentTo(new[] { new KeyValuePair <string, float>("key1name", 10), new KeyValuePair <string, float>("key2name", 20) }); } }
public void GetFieldsToEdit_ItemHasFields_ReturnFields(Db db, DbItem item, DbField field1, DbField field2) { item.Add(field1); item.Add(field2); db.Add(item); var testItem = db.GetItem(item.ID); var expectedResult = new [] { field1.Name + "|" + field2.Name, field2.Name + "|" + field1.Name }; GetFieldsToEditService.GetFieldsToEdit(testItem).Should().BeOneOf(expectedResult); }
public void GetMaxImageHeight_NoImageItems_ZeroHeight(Db db, DbItem modelItem) { //Arrange modelItem.Add(new DbItem("Inner item 1", new ID(), Templates.TeaserHeadline.ID)); modelItem.Add(new DbItem("Inner item 2", new ID(), Templates.TeaserHeadline.ID)); db.Add(modelItem); var model = new DynamicTeaserModel(db.GetItem(modelItem.ID)); //Act var maxHeight = model.GetMaxImageHeight(); //Assert maxHeight.Should().Be(0); }
public void Build_with_valid_model_should_create_comment() { //given _commentRepository.Setup(x => x.Create(It.IsAny <Comment>())) .Returns(true); var dbItem = new DbItem("Article") { }; dbItem.Add(new DbField("Comments")); Db db = new Db() { dbItem }; Item article = db.GetItem("/sitecore/content/article"); _context.Setup(x => x.GetItem <Item>(It.IsAny <Guid>(), false, false)) .Returns(article); //when var result = _commentModelBuilder.Build(new CommentViewModel()); //then result.Should().BeTrue(); }
public void RemoveVersionReturnsFalseIfNoValueFoundForLanguage(DbItem sut, DbField field, string language) { field.Values[language] = new Dictionary <int, string>(); sut.Add(field); sut.RemoveVersion(language).Should().BeFalse(); }
public void GetDatasources_LocationSetByRelativePath_ShouldReturnSourcesFromSettingItem([Frozen] ISettingsProvider settingsProvider, [Greedy] ItemDatasourceProvider provider, string name, string contextItemName, Db db, string settingItemName, Item item, string sourceRootName) { var contextItemId = ID.NewID; var contextDbItem = new DbItem(contextItemName.Replace("-", String.Empty), contextItemId); var rootName = sourceRootName.Replace("-", string.Empty); var sourceRoot = new DbItem(rootName); contextDbItem.Add(sourceRoot); db.Add(contextDbItem); provider.Database = db.Database; var settingId = ID.NewID; var settingDbItem = new DbItem(settingItemName.Replace("-", String.Empty), settingId, Templates.DatasourceConfiguration.ID) { new DbField(Templates.DatasourceConfiguration.Fields.DatasourceLocation) { { "en", $"./{rootName}" } } }; var contextItem = db.GetItem(contextItemId); db.Add(settingDbItem); var sourceRootItem = db.GetItem(sourceRoot.ID); var settingItem = db.GetItem(settingId); settingsProvider.GetSettingItem(Arg.Any <string>(), Arg.Any <Item>()).Returns(settingItem); var sources = provider.GetDatasources(name, contextItem); sources.Should().NotBeNull(); sources.Should().Contain(sourceRootItem); }
public void GetSupportedLanguages_NoneSelected_ShouldReturnEmptyList(Db db, [Content] DbTemplate template, DbItem item, string rootName) { template.BaseIDs = new[] { Templates.Site.ID, Feature.Language.Templates.LanguageSettings.ID }; var languageItem = new DbItem("en"); db.Add(languageItem); var siteRootItem = new DbItem(rootName, ID.NewID, template.ID) { new DbField(Feature.Language.Templates.LanguageSettings.Fields.SupportedLanguages) { { "en", "" } } }; siteRootItem.Add(item); db.Add(siteRootItem); var contextItem = db.GetItem(item.ID); Context.Item = contextItem; var supportedLanguages = LanguageRepository.GetSupportedLanguages(); supportedLanguages.Count().Should().Be(0); }
static void Main(string[] args) { var assembly = Assembly.GetExecutingAssembly(); var templateMapping = new AutoTemplateMapping(assembly); using (var db = new Db()) { var pageTemplate = new DbTemplate("Page", new Sitecore.Data.ID("{B30304AF-6B39-4AB7-832E-C858A76B9C7B}")) { "Title" }; db.Add(pageTemplate); var articlePageTemplate = new DbTemplate("ArticlePage", new Sitecore.Data.ID("{13175CCF-54D3-43B3-B2D8-EF8863916B53}")) { BaseIDs = new [] { pageTemplate.ID } }; articlePageTemplate.Add("Content"); db.Add(articlePageTemplate); var page1Item = new DbItem("Page1") { TemplateID = pageTemplate.ID }; page1Item.Add("Title", "Welcome"); db.Add(page1Item); var articlePage1Item = new DbItem("ArticlePage1") { TemplateID = articlePageTemplate.ID }; articlePage1Item.Add("Title", "Welcome to article 1"); articlePage1Item.Add("Content", "This is the content of article 1"); db.Add(articlePage1Item); var page1 = templateMapping.ResolveAs <IPageItem>(db.GetItem(page1Item.ID)).ValueOrFailure(); Console.WriteLine(page1.Title.RawValue); var article1 = templateMapping.ResolveAs <IArticlePageItem>(db.GetItem(articlePage1Item.ID)).ValueOrFailure(); Console.WriteLine(article1.Title.RawValue); Console.WriteLine(article1.Content.RawValue); Console.ReadKey(); } }
public void ShouldReturnItemChildren(GetChildrenCommand sut, DbItem dbitem, DbItem dbchild1, DbItem dbchild2, Item item, Item child1, Item child2) { // arrange dbitem.Add(dbchild1); dbitem.Add(dbchild2); sut.DataStorage.GetFakeItem(item.ID).Returns(dbitem); sut.DataStorage.GetSitecoreItem(dbchild1.ID, item.Language).Returns(child1); sut.DataStorage.GetSitecoreItem(dbchild2.ID, item.Language).Returns(child2); sut.Initialize(item); // act var children = (ItemList)ReflectionUtil.CallMethod(sut, "DoExecute"); // assert children[0].Should().Be(child1); children[1].Should().Be(child2); }
public ItemBuilder WithDisplayName(string value) { var field = new DbField(ID.NewID) { Value = value, Type = "text", Name = DispalyNameFieldName }; _item.Add(field); return(this); }
public void GetSupportedLanguages_NoneSelected_ShouldReturnEmptyList(Db db, [Content] DbTemplate template, DbItem item, string rootName, ISiteDefinitionsProvider siteProvider, BaseLinkManager linkManager) { // Arrange template.BaseIDs = new[] { Templates.Site.ID, Feature.Language.Templates.LanguageSettings.ID }; var languageItem = new DbItem("en"); db.Add(languageItem); var siteRootId = ID.NewID; var siteRootItem = new DbItem(rootName, siteRootId, template.ID) { new DbField(Feature.Language.Templates.LanguageSettings.Fields.SupportedLanguages) { { "en", "" } } }; siteRootItem.Add(item); db.Add(siteRootItem); var contextItem = db.GetItem(item.ID); var siteContext = new Mock <Foundation.Multisite.SiteContext>(siteProvider); siteContext.Setup(x => x.GetSiteDefinition(contextItem)).Returns(new SiteDefinition { Item = db.GetItem(siteRootId) }); var repository = new LanguageRepository(siteContext.Object, linkManager); var fakeSite = new FakeSiteContext(new StringDictionary() { { "name", "fake" }, { "database", "master" }, { "rootPath", siteRootItem.FullPath }, { "hostName", "local" } }); using (new FakeSiteContextSwitcher(fakeSite)) { using (new ContextItemSwitcher(contextItem)) { // Act var supportedLanguages = repository.GetSupportedLanguages(); // Assert supportedLanguages.Count().Should().Be(0); } } }
public void HasFieldValue_FieldIsNull_ShouldReturnFalse(Db db, DbItem item, DbField field) { //Arrange field.Value = null; item.Add(field); db.Add(item); var testItem = db.GetItem(item.ID); //Act testItem.FieldHasValue(field.ID).Should().BeFalse(); }
public void HasFieldValue_FieldHasValue_ShouldReturnTrue(Db db, DbItem item, DbField field, string value) { //Arrange field.Value = value; item.Add(field); db.Add(item); var testItem = db.GetItem(item.ID); //Act testItem.FieldHasValue(field.ID).Should().BeTrue(); }
public void GetMaxImageHeight_ImageItems_ReturnMaxHeight(Db db, int maxHeight, int difference, DbItem modelItem) { //Arrange modelItem.Add(new DbItem("Inner item 1", new ID(), Templates.TeaserHeadline.ID) { { Templates.TeaserContent.Fields.Image, $@"<image mediapath="""" src="""" height=""{maxHeight}"" mediaid="""" ></image>" } }); modelItem.Add(new DbItem("Inner item 2", new ID(), Templates.TeaserHeadline.ID) { { Templates.TeaserContent.Fields.Image, $@"<image mediapath="""" src="""" height=""{maxHeight - difference}"" mediaid="""" ></image>" } }); db.Add(modelItem); var model = new DynamicTeaserModel(db.GetItem(modelItem.ID)); //Act var result = model.GetMaxImageHeight(); //Assert result.Should().Be(maxHeight); }
public void ShouldAddChildItem() { // arrange var parent = new DbItem("parent"); var child = new DbItem("child"); // act parent.Add(child); // assert parent.Children.Single().Should().BeEquivalentTo(child); }
public void GetSupportedLanguages_OneSelected_ShouldReturnSelected(Db db, [Content] DbTemplate template, DbItem item, string rootName, ISiteDefinitionsProvider siteProvider) { const string supportedLanguage = "en"; const string url = "/lorem/"; // Arrange template.BaseIDs = new[] { Templates.Site.ID, Feature.Language.Templates.LanguageSettings.ID }; var languageItem = new DbItem(supportedLanguage); db.Add(languageItem); var siteRootId = ID.NewID; var siteRootItem = new DbItem(rootName, siteRootId, template.ID) { new DbField(Feature.Language.Templates.LanguageSettings.Fields.SupportedLanguages) { { supportedLanguage, languageItem.ID.ToString() } } }; siteRootItem.Add(item); db.Add(siteRootItem); var contextItem = db.GetItem(item.ID); var linkManager = new Mock <BaseLinkManager>(); linkManager.Setup(x => x.GetItemUrl(contextItem, It.IsAny <UrlOptions>())).Returns(url); var siteContext = new Mock <Foundation.Multisite.SiteContext>(siteProvider); siteContext.Setup(x => x.GetSiteDefinition(contextItem)).Returns(new SiteDefinition { Item = db.GetItem(siteRootId) }); var repository = new LanguageRepository(siteContext.Object, linkManager.Object); using (new ContextItemSwitcher(contextItem)) { // Act var supportedLanguages = repository.GetSupportedLanguages(); // Assert supportedLanguages.Count().Should().BeGreaterThan(0); supportedLanguages.First().TwoLetterCode.Should().Be(supportedLanguage); supportedLanguages.First().Url.Should().Be(url); } }
public void Process_SiteSettingNameHasWrongFirmat_SourcesAndTemplateAreNotSet([Frozen] DatasourceProviderFactory factory, 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(); }
private SiteContext BuildSiteContext(Db db, Db coreDb, ID profileId, ID interestFolder, IEnumerable <string> interests) { var contextId = ID.NewID; var interestItem = new DbItem("InterestsFolder", interestFolder); interests.Select(i => new DbItem(i) { TemplateID = Templates.Interest.ID, Fields = { new DbField("Title", Templates.Interest.Fields.Title) { Value = i } } }) .ToList().ForEach(x => interestItem.Add(x)); db.Add(new DbItem("siteroot") { TemplateID = Templates.ProfileSettigs.ID, Fields = { new DbField("UserProfile", Templates.ProfileSettigs.Fields.UserProfile) { Value = profileId.ToString() }, new DbField("InterestsFolder", Templates.ProfileSettigs.Fields.InterestsFolder) { Value = interestFolder.ToString() } }, Children = { interestItem } }); coreDb.Add(new DbItem("UserProfile", profileId)); var fakeSite = new FakeSiteContext(new StringDictionary { { "rootPath", "/sitecore/content/siteroot" }, { "database", "master" } }) as SiteContext; Context.Item = db.GetItem(interestFolder); return(fakeSite); }
public void ShouldReturnTrueIfHasChildren(HasChildrenCommand sut, Item item, DbItem fakeItem, DbItem child) { // arrange fakeItem.Add(child); sut.DataStorage.GetSitecoreItem(item.ID, item.Language).Returns(item); sut.DataStorage.GetFakeItem(item.ID).Returns(fakeItem); sut.Initialize(item); // act var result = (bool)ReflectionUtil.CallMethod(sut, "DoExecute"); // assert result.Should().BeTrue(); }
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 GetFieldEditorOptions_HasFields_DescriptorForEachField([Content] string[] fieldNames, NameValueCollection form, Db db, DbItem item) { //Arrange foreach (var field in fieldNames) { item.Add(new DbField(field)); } db.Add(item); var testItem = db.GetItem(item.ID); var pipedFieldNames = string.Join("|", fieldNames); //Act var result = GetFieldsToEditService.GetFieldEditorOptions(form, pipedFieldNames, testItem); result.Fields.Count.Should().Be(fieldNames.Length); //Assert }
public void ShouldSetChildItemFullPathOnDbInit() { // arrange var parent = new DbItem("parent"); var child = new DbItem("child"); parent.Add(child); // act using (new Db { parent }) { // assert child.FullPath.Should().Be("/sitecore/content/parent/child"); } }
public void GetSupportedLanguages_NoneSelected_ShouldReturnEmptyList(Db db, [Content] DbTemplate template, DbItem item, string rootName) { template.BaseIDs = new[] { Templates.Site.ID, Feature.Language.Templates.LanguageSettings.ID }; var languageItem = new DbItem("en"); db.Add(languageItem); var siteRootItem = new DbItem(rootName, ID.NewID, template.ID) { new DbField(Feature.Language.Templates.LanguageSettings.Fields.SupportedLanguages) { { "en", "" } } }; siteRootItem.Add(item); db.Add(siteRootItem); var contextItem = db.GetItem(item.ID); Context.Item = contextItem; var fakeSite = new FakeSiteContext(new StringDictionary() { { "name", "fake" }, { "database", "master" }, { "rootPath", siteRootItem.FullPath }, { "hostName", "local" } }); using (new FakeSiteContextSwitcher(fakeSite)) { var supportedLanguages = LanguageRepository.GetSupportedLanguages(); supportedLanguages.Count().Should().Be(0); } }
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); }
private static Db CreateHomeFolderPost([CanBeNull] string name = null, [CanBeNull] DbField field = null) { var bloggrHome = new ID(); var dbItem = new DbItem(name ?? "01-Post"); if (field != null) { dbItem.Add(field); } return(new Db { new DbTemplate("Bloggr Home", bloggrHome), new DbItem("Home", new ID(), bloggrHome) { new DbItem("Folder") { dbItem } } }); }
public void GetSupportedLanguages_ShouldReturlListOfSupportedLanguages(Db db, DbItem item, string rootName) { var contextItemId = ID.NewID; var rootId = ID.NewID; var template = new DbTemplate(); template.BaseIDs = new[] { Foundation.Multisite.Templates.Site.ID, Templates.LanguageSettings.ID }; var languageItem = new DbItem("en"); db.Add(languageItem); db.Add(new DbTemplate(Foundation.Multisite.Templates.Site.ID)); db.Add(new DbTemplate(Templates.LanguageSettings.ID) { Fields = { { Templates.LanguageSettings.Fields.SupportedLanguages, languageItem.ID.ToString() } } }); db.Add(template); var rootItem = new DbItem(rootName, rootId, template.ID) { new DbField(Templates.LanguageSettings.Fields.SupportedLanguages) { { "en", languageItem.ID.ToString() } } }; rootItem.Add(item); db.Add(rootItem); var contextItem = db.GetItem(item.ID); Sitecore.Context.Item = contextItem; var supportedLanguages = LanguageRepository.GetSupportedLanguages(); supportedLanguages.Count().Should().BeGreaterThan(0); }
public void AddThrowsIfChildItemIsNull(DbItem sut) { Action action = () => sut.Add((DbItem)null); action.ShouldThrow<ArgumentNullException>().WithMessage("*child"); }
private Db GetDatabase(out RenderingDefinition sourceRendering, out Item targetRenderingItem, out DeviceDefinition device) { var db = new Db(); var page = new DbItem("page", _pageId); db.Add(page); db.Add(new DbItem("sourceRendering", _sourceRenderingItemId)); db.Add(new DbItem("targetRendering", _targetRenderingItemId)); page.Add(new DbField("__Renderings", Sitecore.FieldIDs.LayoutField) { Value = string.Format(@"<r xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:s=""s""> <d id=""{{E68F244A-399C-4B86-B517-5B116547CECE}}""> <r uid=""{1}"" s:id=""{2}"" s:ph=""pagebody"" /> <r uid=""{{CDFD3A99-7A88-4D72-8E5C-2E0F3565C052}}"" s:ds=""{{7D426874-C107-4A7A-A0C0-D0E041C649C2}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{3}_{0:d}"" /> <r uid=""{{305AE5CD-9555-4258-91A6-FF939BC0650F}}"" s:ds=""{{E3B3F0F6-CB76-4EA6-A3F6-681490B2345B}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{4}_{0:d}"" /> <r uid=""{{8F5FE967-B933-4E77-8731-D10EABEEBE9A}}"" s:ds=""{{143B554C-E9BF-414D-81B8-CDCFFD2702F4}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{4}_{0:d}"" /> <r uid=""{{C4718241-6719-4ED0-A5D5-5875F834D89D}}"" s:ds=""{{E4E35B2C-709E-4547-B217-155604766169}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{4}_{0:d}"" /> <r uid=""{{E1891090-34EA-4DB3-91E9-D3D312EA2B4F}}"" s:ds=""{{D46A9CBF-F999-440B-B551-91667A6C1FCA}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{4}_{0:d}"" /> <r uid=""{{F30E85D9-7F9D-4FAE-B70B-DF57DC4CF78C}}"" s:ds=""{{2825111A-5285-48DE-A5F5-F28B7C3181A6}}"" s:id=""{{D97EB6F7-26BF-4347-8988-D6019C3E2E0B}}"" s:ph=""{4}_{0:d}"" /> </d> </r>", _renderingUniqueId, ID.Parse(_renderingUniqueId), _sourceRenderingItemId, _placeholderKeyWith1Rendering, _placeholderKeyWith4Renderings ) }); device = new DeviceDefinition { ID = ID.NewID.ToString(), Renderings = new ArrayList { new RenderingDefinition { UniqueId = ID.Parse(_renderingUniqueId).ToString(), ItemID = _sourceRenderingItemId.ToString(), Placeholder = "pagebody" }, new RenderingDefinition { Placeholder = string.Format("{0}_{1}", _placeholderKeyWith1Rendering, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, new RenderingDefinition { Placeholder = string.Format("{0}_{1}", _placeholderKeyWith4Renderings, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, new RenderingDefinition { Placeholder = string.Format("{0}_{1}", _placeholderKeyWith4Renderings, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, new RenderingDefinition { Placeholder = string.Format("{0}_{1}", _placeholderKeyWith4Renderings, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, new RenderingDefinition { Placeholder = string.Format("{0}_{1}", _placeholderKeyWith4Renderings, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, new RenderingDefinition { Placeholder = string.Format("/pagebody/{0}_{1}", _placeholderKeyNestedWith1Rendering, _renderingUniqueId), UniqueId = ID.NewID.ToString(), ItemID = ID.NewID.ToString() }, } }; targetRenderingItem = db.GetItem(_targetRenderingItemId); sourceRendering = device.GetRenderingByUniqueId(new ID(_renderingUniqueId).ToString()); return(db); }
public void AddThrowsIfFieldIdIsNull(DbItem sut, string value) { Action action = () => sut.Add((ID)null, value); action.ShouldThrow <ArgumentNullException>().WithMessage("*fieldId"); }
public void AddThrowsIfChildItemIsNull(DbItem sut) { Action action = () => sut.Add((DbItem)null); action.ShouldThrow <ArgumentNullException>().WithMessage("*child"); }
public void SutAddsChildItem(DbItem sut, DbItem child) { sut.Add(child); sut.Children.Single().Should().BeEquivalentTo(child); }
public void ShouldReturnFalseIfNoValueFoundForLanguage(DbItem sut, DbField field, string language) { field.Values[language] = new Dictionary<int, string>(); sut.Add(field); sut.RemoveVersion(language).Should().BeFalse(); }
public void AddThrowsIfFieldIdIsNull(DbItem sut, string value) { Action action = () => sut.Add((ID)null, value); action.ShouldThrow<ArgumentNullException>().WithMessage("*fieldId"); }