예제 #1
0
        public void TestAddAsset()
        {
            AssetsDataManager dataManager = new AssetsDataManager();

            dataManager.AddAsset("Skill", "Type", "ID0", 0, 0, 0);
            Assert.AreEqual(1, dataManager.GetAssetCount());
        }
예제 #2
0
        public void BasicTest()
        {
            AssetsDataManager     alm = new AssetsDataManager();
            ProblemLinkageManager plm = new ProblemLinkageManager(alm);

            Assert.IsNotNull(plm);
        }
예제 #3
0
        public void NullGroupId()
        {
            AssetsDataManager   alm = new AssetsDataManager();
            ProblemDataManager  plm = new ProblemDataManager();
            GroupLinkageManager glm = new GroupLinkageManager(alm, plm);

            Assert.IsNull(glm.getAssets("groupId"));
        }
예제 #4
0
        public void BasicCtorTest()
        {
            AssetsDataManager   alm = new AssetsDataManager();
            ProblemDataManager  plm = new ProblemDataManager();
            GroupLinkageManager glm = new GroupLinkageManager(alm, plm);

            Assert.IsNotNull(glm);
        }
예제 #5
0
        public void AddLinkage()
        {
            AssetsDataManager     alm = new AssetsDataManager();
            ProblemLinkageManager plm = new ProblemLinkageManager(alm);

            plm.AddProblemLinkage("id", new string [] { "asset1" });
            Assert.AreEqual("asset1", plm.GetAssets("id")[0]);
        }
예제 #6
0
        public void TestGetAssetsFor()
        {
            AssetsDataManager dataManager = new AssetsDataManager();

            dataManager.AddAsset("Skill", "Type", "ID0", 0, 0, 0);
            IList <AssetRecomendation> assets = dataManager.GetAssetsFor("Skill");

            Assert.AreEqual(1, assets.Count);
        }
예제 #7
0
        public void TestGetAssetsTypes()
        {
            AssetsDataManager dataManager = new AssetsDataManager();

            dataManager.AddAsset("Skill", "Type", "ID0", 0, 0, 0);
            dataManager.AddAsset("Skill", "Type2", "ID1", 0, 0, 0);
            Assert.AreEqual(2, dataManager.GetAssetsTypes().Count);
            Assert.AreEqual("Type", dataManager.GetAssetsTypes()[0]);
            Assert.AreEqual("Type2", dataManager.GetAssetsTypes()[1]);
        }
예제 #8
0
        public void  AddAssetTest()
        {
            string              groupId = "groupId";
            AssetsDataManager   alm     = new AssetsDataManager();
            ProblemDataManager  plm     = new ProblemDataManager();
            GroupLinkageManager glm     = new GroupLinkageManager(alm, plm);

            glm.addAssets(groupId, new string[] { "asset1" });
            Assert.AreEqual(1, glm.getAssets(groupId).Count);
        }
예제 #9
0
        public void TestStoreData()
        {
            AssetsDataManager dataManager = new AssetsDataManager();

            dataManager.AddAsset("Skill", "Type", "ID0", 0, 0, 0);
            dataManager.AddAsset("Skill", "Type2", "ID1", 0, 0, 0);
            MockDataStorageDelegate storage = new MockDataStorageDelegate();

            dataManager.StoreData(storage);
            Assert.AreEqual(2, storage.callCount);
        }
예제 #10
0
        public void BasicTest()
        {
            AssetsDataManager                adm  = new AssetsDataManager();
            ProblemDataManager               pdm  = new ProblemDataManager();
            SkillsDataManager                sdm  = new SkillsDataManager();
            GroupLinkageManager              glm  = new GroupLinkageManager(adm, pdm);
            ProblemLinkageManager            plm  = new ProblemLinkageManager(adm);
            DefaultAssetRecommendationEngine dare = new DefaultAssetRecommendationEngine(adm, sdm, glm, plm);

            Assert.IsNotNull(dare);
        }
예제 #11
0
        public void AddAssetsToExistingEmptyList()
        {
            string              groupId = "groupId";
            AssetsDataManager   alm     = new AssetsDataManager();
            ProblemDataManager  plm     = new ProblemDataManager();
            GroupLinkageManager glm     = new GroupLinkageManager(alm, plm);

            glm.addGroupId(groupId);
            glm.addAssets(groupId, new string [] { "assets" });
            Assert.AreEqual("assets", glm.getAssets(groupId)[0]);
        }
예제 #12
0
        public void AddMultipleProblemLinks()
        {
            AssetsDataManager     alm = new AssetsDataManager();
            ProblemLinkageManager plm = new ProblemLinkageManager(alm);

            plm.AddProblemLinkage("id1", "asset1");
            plm.AddProblemLinkage("id2", new string [] { "asset2", "asset3" });

            Assert.AreEqual("asset1", plm.GetAssets("id1")[0]);
            Assert.AreEqual("asset2", plm.GetAssets("id2")[0]);
            Assert.AreEqual("asset3", plm.GetAssets("id2")[1]);
        }
예제 #13
0
        public void AddDuplicateAssetToExistingList()
        {
            string groupId = "groupId";

            string []           asset = new string [] { "asset1" };
            AssetsDataManager   alm   = new AssetsDataManager();
            ProblemDataManager  plm   = new ProblemDataManager();
            GroupLinkageManager glm   = new GroupLinkageManager(alm, plm);

            glm.addAssets(groupId, asset);
            Assert.AreEqual(1, glm.getAssets(groupId).Count);

            glm.addAssets(groupId, asset);
            Assert.AreEqual(1, glm.getAssets(groupId).Count);
        }
예제 #14
0
        private void createAssetsSkills(int skillCount, int assetTypesCount, int assetCount, out AssetsDataManager adm, out SkillsDataManager sdm)
        {
            adm = new AssetsDataManager();
            pdm = new ProblemDataManager();
            sdm = new SkillsDataManager();
            glm = new GroupLinkageManager(adm, pdm);
            plm = new ProblemLinkageManager(adm);

            for (int skillId = 0; skillId < skillCount; skillId++)
            {
                sdm.AddSkill(skillIdPrefix + skillId.ToString(), false);
                for (int assetTypeId = 0; assetTypeId < assetTypesCount; assetTypeId++)
                {
                    for (int assetId = 0; assetId < assetCount; assetId++)
                    {
                        adm.AddAsset(skillIdPrefix + skillId, assetTypePrefix + assetTypeId, assetIdPrefix + assetId, 0, 0, 0);
                    }
                }
            }
        }
예제 #15
0
        public void TestMarkAssetCompleted()
        {
            AssetsDataManager dataManager = new AssetsDataManager();

            dataManager.AddAsset("Skill", "Type", "ID0", 0, 0, 0);
            IList <AssetRecomendation> assets = dataManager.GetAssetsFor("Skill");

            Assert.AreEqual(0, assets[0].GetTimesUsed());
            Assert.AreEqual(0, assets[0].GetLastAccessed());
            Assert.AreEqual(0, assets[0].GetFirstAccessed());

            dataManager.MarkAssetCompleted("ID0");
            Assert.AreEqual(1, assets[0].GetTimesUsed());
            Assert.Greater(assets[0].GetLastAccessed(), 0);
            Assert.Greater(assets[0].GetFirstAccessed(), 0);
            Assert.AreEqual(assets[0].GetLastAccessed(), assets[0].GetFirstAccessed());

            dataManager.MarkAssetCompleted("ID0");
            Assert.AreEqual(2, assets[0].GetTimesUsed());
            Assert.GreaterOrEqual(assets[0].GetLastAccessed(), assets[0].GetFirstAccessed());
        }
예제 #16
0
        public void AddMultipleAssetsToExistingList()
        {
            string groupId = "groupId";

            string []           assets = new string [] { "asset1" };
            AssetsDataManager   alm    = new AssetsDataManager();
            ProblemDataManager  plm    = new ProblemDataManager();
            GroupLinkageManager glm    = new GroupLinkageManager(alm, plm);

            glm.addAssets(groupId, assets);
            Assert.AreEqual(1, glm.getAssets(groupId).Count);

            assets = new string[] { "asset2", "asset3", "asset4" };
            glm.addAssets(groupId, assets);

            foreach (string asset in assets)
            {
                Assert.IsTrue(glm.getAssets(groupId).Contains(asset));
            }
            Assert.IsTrue(glm.getAssets(groupId).Contains("asset1"));
        }