Esempio n. 1
0
        public void SaveActorProfileTest()
        {
            TCAPI        target       = new TCAPI(new Uri("http://cloud.scorm.com/tc/public"), new BasicHTTPAuth("test", "password"));
            ActorProfile actorProfile = new ActorProfile();

            actorProfile.Actor     = new Actor("Example", "mailto:[email protected]");
            actorProfile.ProfileId = "Example";
            actorProfile.Body      = "This is some test";
            ActorProfile previousProfile = new ActorProfile();

            previousProfile.Actor     = new Actor("Example", "mailto:[email protected]");
            previousProfile.ProfileId = "Example";
            previousProfile.Body      = "Hello";
            bool overwrite = true;

            target.SaveActorProfile(actorProfile, previousProfile, overwrite);
            Assert.Inconclusive(INCONCLUSIVE);
        }
Esempio n. 2
0
        public void ActorProfileTest()
        {
            TinCanJsonConverter converter = new TinCanJsonConverter();
            TCAPI target = new TCAPI(new Uri("http://cloud.scorm.com/tc/public"), new BasicHTTPAuth("CZSWMUZPSE", "vwiuflgsY22FDXpHA4lwwe5hrnUXvcyJjW3fDrpH"));
            Actor actor  = new Actor("Mufasa", "mailto:[email protected]");

            string[] profileIds      = { "The Lion King", "The Fallen King", "The New King" };
            string[] profileContents =
            {
                "Mufasa rules his country as a proud and fair king of lions, celebrating his recently newborn son Simba.",
                "Scar kills Mufasa, simply muttering the words 'Long Live the King'",
                "Simba finally realizes he must follow in his fathers footsteps to save the kingdom from the evil Scar."
            };

            // Clear all existing profiles.
            target.DeleteAllActorProfile(actor);

            NullableDateTime since = null;

            string[] actual;
            actual = target.GetActorProfileIds(actor, since);

            Assert.AreEqual(0, actual.Length);

            /* Save a new actor profile */
            ActorProfile p1 = new ActorProfile();

            p1.Actor     = actor;
            p1.ProfileId = profileIds[0];
            p1.Body      = profileContents[0];
            ActorProfile pp = new ActorProfile();

            pp.ProfileId = profileIds[0];
            pp.Actor     = actor;
            pp.Body      = profileContents[0];
            target.SaveActorProfile(p1, pp, true);
            actual = target.GetActorProfileIds(actor, since);

            Assert.AreEqual(1, actual.Length);

            p1.ProfileId = profileIds[1];
            p1.Body      = profileContents[1];
            pp.ProfileId = profileIds[1];
            target.SaveActorProfile(p1, pp, true);
            actual = target.GetActorProfileIds(actor, since);

            Assert.AreEqual(2, actual.Length);

            p1.ProfileId = profileIds[2];
            p1.Body      = profileContents[2];
            pp.ProfileId = profileIds[2];
            target.SaveActorProfile(p1, pp, true);
            actual = target.GetActorProfileIds(actor);

            Assert.AreEqual(3, actual.Length);

            // Ensure all the posted data matches

            ActorProfile pResult = target.GetActorProfile(actor, profileIds[0]);

            Assert.AreEqual(profileContents[0], pResult.Body);

            pResult = target.GetActorProfile(actor, profileIds[1]);
            Assert.AreEqual(profileContents[1], pResult.Body);

            pResult = target.GetActorProfile(actor, profileIds[2]);
            Assert.AreEqual(profileContents[2], pResult.Body);

            target.DeleteActorProfile(actor, profileIds[0]);
            actual = target.GetActorProfileIds(actor);

            Assert.AreEqual(2, actual.Length);

            target.DeleteAllActorProfile(actor);
            actual = target.GetActorProfileIds(actor);

            Assert.AreEqual(0, actual.Length);
        }