コード例 #1
0
        public void ToQuotedStringTest()
        {
            TestInfrastructure.DebugLineStart(TestContext);
            if (TestInfrastructure.IsActive(TestContext))
            {
                using (IDictionary writeLM = TestInfrastructure.GetLMConnection(TestContext, TestInfrastructure.GetAdminUser))
                {
                    ICard  card  = writeLM.Cards.AddNew();
                    IWords words = card.Question;

                    for (int i = 0; i < TestInfrastructure.Random.Next(10, 50); i++)
                    {
                        IWord word = words.CreateWord("Word " + i.ToString(), WordType.Word, true);
                        words.AddWord(word);
                    }

                    string quotedStringClone = string.Empty;
                    foreach (IWord var in words.Words)
                    {
                        quotedStringClone += "\"" + var.Word + "\", ";
                    }
                    quotedStringClone = quotedStringClone.Substring(0, quotedStringClone.Length - 2);

                    Assert.AreEqual <string>(quotedStringClone, words.ToQuotedString(), "IWords.ToQuotedString does not match with expected output.");
                }
            }
            TestInfrastructure.DebugLineEnd(TestContext);
        }