public void ShouldAddTags() { TagOptions tagOptions = new TagOptions(); TagHolder th = new TagHolder(tagOptions); th.Tags.Should().HaveCount(0); th.Add("TagName"); th.Tags.Should().HaveCount(1); }
protected virtual void OnValidate() { if (Application.isPlaying) { return; } tagHolder = GetComponent <TagHolder>(); rigidbody = GetComponent <Rigidbody>(); collider = GetComponent <Collider>(); }
public List <string> GetTags() { List <TagDb> tagList = tags.Find(tags => true).ToList(); TagHolder tagHold = new TagHolder(); foreach (TagDb t in tagList) { tagHold.tagHolder.Add(t.tagName); } return(tagHold.tagHolder); }
public void ShouldFindInName() { TagOptions tagOptions = new TagOptions(); tagOptions.TagNotStoredInFileName = true; TagHolder th = new TagHolder(tagOptions); th.SplitName("This is a file name [TAG tagB]"); th.Tags.Should().HaveCount(0); }
public void ShouldNotAddSameTagTwice() { TagOptions tagOptions = new TagOptions(); TagHolder th = new TagHolder(tagOptions); th.SplitName("My My My"); th.Tags.Should().HaveCount(1); th.Tags[0].Name.Should().Be("My"); }
public void ShouldFindNoWhenTagInBoxsAndNoBoxes() { TagOptions tagOptions = new TagOptions(); tagOptions.TagInBoxs = true; TagHolder th = new TagHolder(tagOptions); th.SplitName("This is a file name"); th.Tags.Should().HaveCount(0); th.Tags.Should().BeEmpty(); }
public void ShouldCreateNameFromTags() { TagOptions tagOptions = new TagOptions(); TagHolder th = new TagHolder(tagOptions); th.SplitName("My First Tags"); th.Tags.Should().HaveCount(3); string name = th.CreateNameFromTags(); name.Should().Be("My First Tags"); }
public void ShouldFindTagsInBoxes() { TagOptions tagOptions = new TagOptions(); tagOptions.TagInBoxs = true; TagHolder th = new TagHolder(tagOptions); th.SplitName("This is a file name [TAG tagB]"); th.Tags.Should().HaveCount(2); th.Tags[0].Name.Should().Be("TAG"); th.Tags[1].Name.Should().Be("tagB"); }
public void ShouldSplitString(string name) { TagOptions tagOptions = new TagOptions(); TagHolder th = new TagHolder(tagOptions); th.SplitName(name); th.Tags.Should().HaveCount(3); th.Tags[0].Name.Should().Be("My"); th.Tags[1].Name.Should().Be("First"); th.Tags[2].Name.Should().Be("Tags"); }
public void ShouldAddTagToGlobal() { GlobalTagStore gts = ServiceLocator.Instance.GetService <GlobalTagStore>(); gts.ClearTags(); TagOptions tagOptions = new TagOptions(); TagHolder th = new TagHolder(tagOptions); th.SplitName("TasgA TagB"); gts.Tags.Should().HaveCount(2); }
public void ShouldKeepFirstPartOfName() { TagOptions tagOptions = new TagOptions(); tagOptions.KeepFirstPartOfName = true; TagHolder th = new TagHolder(tagOptions); th.SplitName("PIC00001 With Tags"); th.Tags.Should().HaveCount(2); string name = th.CreateNameFromTags(); name.Should().Be("PIC00001 With Tags"); }
public void ShouldSplitPipedString() { TagOptions tagOptions = new TagOptions(); tagOptions.Seperator = '|'; TagHolder th = new TagHolder(tagOptions); th.SplitName("My|First|Tags"); th.Tags.Should().HaveCount(3); th.Tags[0].Name.Should().Be("My"); th.Tags[1].Name.Should().Be("First"); th.Tags[2].Name.Should().Be("Tags"); }
// Heller ikke den her public IActionResult AddTags(string recId, int id = 0) { TagHolder t = new TagHolder(); if (id == 0) { t.tagHolder = tagService.GetTags(); return(View(t)); } else { t.tagHolder = tagService.GetTags(); t.tagMarkedHolder = tagService.GetNameTags(rDbService.GetTags(recId)); return(View(t)); } }
// foreach tag name in tagholder.TagNames, if the tag exists, create a new tag item for it. // If the tag doesn't exist, create the tag and then add a tag item. public async Task AddToDb(TagHolder tagHolder) { _tagHolder = tagHolder; // Make one trip to the database var existingTags = await _db.TagItems .Where(ti => ti.ItemId == _tagHolder.ItemId && ti.ItemType == _tagHolder.ItemType).ToListAsync(); // Keep a list of tags saved so we know what to delete later var tagsOnItem = new List <TagItem>(); foreach (var name in _tagHolder.TagNames) { var tag = await MatchOrMakeTag(name); // Query from tags in memory. var match = await MatchOrMakeTagItem(tag, existingTags); tagsOnItem.Add(match); } var unmatchedItems = existingTags.Except(tagsOnItem); _db.TagItems.RemoveRange(unmatchedItems); await _db.SaveChangesAsync(); }
public void ShouldGetTextinBoxes(string name, string expected) { TagHolder.GetBoxContants(name).Should().Be(expected); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.cell_tag, parent, false); TagHolder holder = new TagHolder(v); return holder; }