public void AddChildTag_same_twice_is_not_added() { var entityUnderTest = new DreamMainTag("Friend"); entityUnderTest.AddChildTag(new DreamChildTag("John")); entityUnderTest.AddChildTag(new DreamChildTag("john")); entityUnderTest.ChildTags.Should().ContainSingle(x => x.Tag == "John"); }
public void TagsToAdd_with_initial_tags_sets_them() { var dreamMainTag = new DreamMainTag("Friend"); dreamMainTag.AddChildTag(new DreamChildTag("Pepe")); dreamMainTag.AddChildTag(new DreamChildTag("Kenobi")); var entityUnderTest = InitializeViewModelForTest(new List <DreamMainTag> { dreamMainTag, new DreamMainTag("Beach") }); entityUnderTest.TagsToAdd.Should().Be("Friend (Pepe, Kenobi), Beach"); }
public void AddChildTag_adds_it() { var entityUnderTest = new DreamMainTag("Friend"); entityUnderTest.AddChildTag(new DreamChildTag("John")); entityUnderTest.ChildTags.Should().ContainSingle(x => x.Tag == "John"); }
public void Reset_with_initial_tags_sets_them_and_removes_any_others() { var dreamMainTag = new DreamMainTag("Friend"); dreamMainTag.AddChildTag(new DreamChildTag("Pepe")); dreamMainTag.AddChildTag(new DreamChildTag("Kenobi")); var entityUnderTest = InitializeViewModelForTest(new List <DreamMainTag> { dreamMainTag, new DreamMainTag("Beach") }); entityUnderTest.TagsToAdd.Should().Be("Friend (Pepe, Kenobi), Beach"); entityUnderTest.AddTag(GetChildTag("Plagueis", "Friend")); entityUnderTest.AddTag(GetMainTag("Car")); entityUnderTest.TagsToAdd.Should().Be("Friend (Pepe, Kenobi, Plagueis), Beach, Car"); entityUnderTest.Reset(); entityUnderTest.TagsToAdd.Should().Be("Friend (Pepe, Kenobi), Beach"); }
private void ParseTags() { foreach (var tag in _mainTags) { var mainTag = ExtractMainTag(tag); if (string.IsNullOrWhiteSpace(mainTag)) { continue; } var newTag = new DreamMainTag(mainTag); if (HasChildren(tag)) { foreach (var childTag in ExtractChildTags(tag)) { newTag.AddChildTag(new DreamChildTag(childTag)); } } DreamTags.Add(newTag); } }