コード例 #1
0
        public void ToNewlineStringTest()
        {
            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 newLineStringClone = string.Empty;
                    foreach (IWord var in words.Words)
                    {
                        newLineStringClone += var.Word + "\r\n";
                    }
                    newLineStringClone = newLineStringClone.Substring(0, newLineStringClone.Length - 2);

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