Askme.Domain.Question.AddTags C# (CSharp) Method

AddTags() public method

public AddTags ( Tag tag ) : void
tag Tag
return void
        public virtual void AddTags(Tag tag)
        {
            tags.Add(tag);
        }

Usage Example

Beispiel #1
0
        public void ShouldBeAbleToCreateQuestionWithTag()
        {
            string questionText = "What is the use of 'var' key word?";
            Tag csharpTag = new Tag("C#");
            Tag javaTag = new Tag("Java");

            User user = new User("shanu", "shanu", "*****@*****.**");
            Question question = new Question(questionText,user);
            question.AddTags(csharpTag);
            question.AddTags(javaTag);

            Assert.AreEqual(csharpTag, question.Tags[0]);
            Assert.AreEqual(javaTag, question.Tags[1]);
        }