public void Get_AutocreateIsTrueEntryDoesntExists_ShouldreturnItem(Db db, [Content] CreateDictionaryEntryServiceTests.DictionaryEntryTemplate entryTemplate, [Content] Item rootItem, IEnumerable <string> pathParts, string defaultValue) { //Arrange var relativePath = string.Join("/", pathParts); var repository = new DictionaryPhraseRepository(new Dictionary() { Root = rootItem, AutoCreate = true }); //Act var result = repository.GetItem(relativePath, defaultValue); //Assert result[Templates.DictionaryEntry.Fields.Phrase].Should().Be(defaultValue); }
public void Get_AutocreateIsTrueEntryDoesntExists_ShouldCreateItem(Db db, [Content] CreateDictionaryEntryServiceTests.DictionaryEntryTemplate entryTemplate, [Content] Item rootItem, IEnumerable <string> pathParts, string defaultValue) { //Arrange var relativePath = string.Join("/", pathParts.Select(ItemUtil.ProposeValidItemName)); var repository = new DictionaryPhraseRepository(new Dictionary() { Root = rootItem, AutoCreate = true }); //Act var result = repository.Get(relativePath, defaultValue); //Assert result.Should().Be(defaultValue); rootItem.Axes.GetItem(relativePath).Should().NotBeNull(); }