DeleteActorProfile() 공개 메소드

Deletes an actor profile
public DeleteActorProfile ( RusticiSoftware.TinCanAPILibrary.Model.Actor actor, string profileId ) : void
actor RusticiSoftware.TinCanAPILibrary.Model.Actor The actor that owns the profile
profileId string The profile document key
리턴 void
 /// <summary>
 ///A test for DeleteActorProfile
 ///</summary>
 //[TestMethod()]
 public void DeleteActorProfileTest()
 {
     TCAPI target = new TCAPI("http://cloud.scorm.com/ScormEngineInterface/TCAPI/public", new BasicHTTPAuth("test", "password"));
     Actor actor = new Actor("Example", "mailto:[email protected]");
     string profileId = "Example";
     target.DeleteActorProfile(actor, profileId);
     Assert.Inconclusive(INCONCLUSIVE);
 }
        /// <summary>
        /// A test for pushing and storing Actor Profiles, then deleting them.
        /// </summary>
        /// <remarks>This test should use a dummy actor, not a real one!</remarks>
        //[TestMethod()]
        public void ActorProfileTest()
        {
            TinCanJsonConverter converter = new TinCanJsonConverter();
            TCAPI target = new TCAPI("https://cloud.scorm.com/ScormEngineInterface/TCAPI/CZSWMUZPSE", 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);
        }