示例#1
0
        public void ICardsTestsCopyCardTest()
        {
            TestInfrastructure.DebugLineStart(TestContext);
            if (TestInfrastructure.IsActive(TestContext))
            {
                using (IDictionary target = TestInfrastructure.GetLMConnection(TestContext, TestInfrastructure.GetAdminUser, true))
                {
                    IChapter chapter = target.Chapters.AddNew();
                    ICard    card    = target.Cards.AddNew();
                    card.Chapter = chapter.Id;

                    LMConnectionParameter param = new LMConnectionParameter(TestContext);
                    param.Callback         = TestInfrastructure.GetAdminUser;
                    param.ConnectionType   = string.Empty;
                    param.IsProtected      = false;
                    param.LearningModuleId = -1;
                    param.Password         = string.Empty;
                    param.RepositoryName   = string.Empty;
                    param.standAlone       = true;

                    using (IDictionary target2 = TestInfrastructure.GetLMConnection(param))
                    {
                        //IChapter chapter2 = target2.Chapters.AddNew();
                        //card.Chapter = chapter2.Id;

                        int before = target2.Cards.Count;
                        int id     = target2.Cards.CopyCard(card);

                        Assert.IsTrue(target2.Cards.Count == before + 1, "Card count should be " + (before + 1) + " but is " + target2.Cards.Count.ToString());
                    }
                }
            }
            TestInfrastructure.DebugLineEnd(TestContext);
        }
 public void IDictionariesAccessToProtectedLM()
 {
     TestInfrastructure.DebugLineStart(TestContext);
     if (TestInfrastructure.IsActive(TestContext) && TestInfrastructure.ConnectionType(TestContext).ToLower() == "sqlce")
     {
         LMConnectionParameter param = new LMConnectionParameter(TestContext);
         param.Password       = "******";
         param.RepositoryName = "AccessToProtectedLM";
         IDictionary target = TestInfrastructure.GetLMConnection(param);
     }
     else
     {
         throw new ProtectedLearningModuleException();
     }
     TestInfrastructure.DebugLineEnd(TestContext);
 }
 public void IDictionariesAccessToProtectedLM()
 {
     TestInfrastructure.DebugLineStart(TestContext);
     if (TestInfrastructure.IsActive(TestContext) && TestInfrastructure.ConnectionType(TestContext).ToLower() == "sqlce")
     {
         LMConnectionParameter param = new LMConnectionParameter(TestContext);
         param.Password = "******";
         param.RepositoryName = "AccessToProtectedLM";
         IDictionary target = TestInfrastructure.GetLMConnection(param);
     }
     else
         throw new ProtectedLearningModuleException();
     TestInfrastructure.DebugLineEnd(TestContext);
 }
示例#4
0
        public void ICardsTestsCopyCardTest()
        {
            TestInfrastructure.DebugLineStart(TestContext);
            if (TestInfrastructure.IsActive(TestContext))
            {
                using (IDictionary target = TestInfrastructure.GetLMConnection(TestContext, TestInfrastructure.GetAdminUser, true))
                {
                    IChapter chapter = target.Chapters.AddNew();
                    ICard card = target.Cards.AddNew();
                    card.Chapter = chapter.Id;

                    LMConnectionParameter param = new LMConnectionParameter(TestContext);
                    param.Callback = TestInfrastructure.GetAdminUser;
                    param.ConnectionType = string.Empty;
                    param.IsProtected = false;
                    param.LearningModuleId = -1;
                    param.Password = string.Empty;
                    param.RepositoryName = string.Empty;
                    param.standAlone = true;

                    using (IDictionary target2 = TestInfrastructure.GetLMConnection(param))
                    {
                        //IChapter chapter2 = target2.Chapters.AddNew();
                        //card.Chapter = chapter2.Id;

                        int before = target2.Cards.Count;
                        int id = target2.Cards.CopyCard(card);

                        Assert.IsTrue(target2.Cards.Count == before + 1, "Card count should be " + (before + 1) + " but is " + target2.Cards.Count.ToString());
                    }
                }
            }
            TestInfrastructure.DebugLineEnd(TestContext);
        }
 /// <summary>
 /// Gets the LM connection.
 /// </summary>
 /// <param name="parameter">The parameter.</param>
 /// <returns></returns>
 /// <remarks>Documented by Dev08, 2009-02-16</remarks>
 public static IDictionary GetLMConnection(LMConnectionParameter parameter)
 {
     return(GetPersistentLMConnection(parameter.TestContext, parameter.RepositoryName, parameter.LearningModuleId, parameter.Callback, parameter.ConnectionType,
                                      parameter.standAlone, parameter.Password, parameter.IsProtected));
 }
 /// <summary>
 /// Gets the LM connection.
 /// </summary>
 /// <param name="parameter">The parameter.</param>
 /// <returns></returns>
 /// <remarks>Documented by Dev08, 2009-02-16</remarks>
 public static IDictionary GetLMConnection(LMConnectionParameter parameter)
 {
     return GetPersistentLMConnection(parameter.TestContext, parameter.RepositoryName, parameter.LearningModuleId, parameter.Callback, parameter.ConnectionType,
         parameter.standAlone, parameter.Password, parameter.IsProtected);
 }
示例#7
0
        public void ISettingsLogoTest()
        {
            TestInfrastructure.DebugLineStart(TestContext);
            if (TestInfrastructure.IsActive(TestContext))
            {
                IMedia media;
                int lmid;

                LMConnectionParameter param = new LMConnectionParameter();
                param.TestContext = TestContext;
                param.RepositoryName = TestContext.TestName;
                param.Callback = TestInfrastructure.GetAdminUser;
                param.ConnectionType = string.Empty;
                param.IsProtected = false;
                param.LearningModuleId = -1;
                param.Password = string.Empty;
                param.standAlone = false;

                using (IDictionary testLM = TestInfrastructure.GetLMConnection(param))
                {
                    lmid = testLM.Id;
                    string testImage = TestInfrastructure.GetTestImage();
                    media = testLM.CreateMedia(EMedia.Image, testImage, true, true, true);
                    testLM.DefaultSettings.Logo = media;
                    testLM.Save();
                }
                param.LearningModuleId = lmid;
                using (IDictionary testLM = TestInfrastructure.GetLMConnection(param))
                {
                    IMedia logo = testLM.DefaultSettings.Logo;
                    Assert.IsNotNull(logo, "LM does not contain a logo Media file.");
                    Assert.AreEqual<IMedia>(media, logo, "Logo Media was not persistent.");
                }
            }
            TestInfrastructure.DebugLineEnd(TestContext);
        }