SaveActivityState() public method

Saves the activity state
public SaveActivityState ( RusticiSoftware.TinCanAPILibrary.Model.ActivityState activityState ) : void
activityState RusticiSoftware.TinCanAPILibrary.Model.ActivityState The activity state to save
return void
        /// <summary>
        /// Test to ensure ETag collisions are not ignored.
        /// </summary>
        //[TestMethod()]
        public void CollisionTest()
        {
            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[] stateIds = { "The Lion King", "The Fallen King", "The New King" };
            string[] stateContents = {
                "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." };

            string activityId = "example.com/TheLionKing";
            string[] results = target.GetActivityStateIds(activityId, actor);

            ActivityState state = new ActivityState(activityId, stateIds[0], actor, stateContents[1], "text/plain");
            ActivityState previous = new ActivityState(activityId, stateIds[0], actor, stateContents[0], "text/plain");
            target.SaveActivityState(state);
            state.Body = stateContents[2];
            target.SaveActivityState(state, false, previous);
        }
 /// <summary>
 ///A test for SaveActivityState
 ///</summary>
 //[TestMethod()]
 public void SaveActivityStateTest()
 {
     TCAPI target = new TCAPI("http://cloud.scorm.com/ScormEngineInterface/TCAPI/public", new BasicHTTPAuth("test", "password"));
     ActivityState activityState = new ActivityState();
     activityState.ActivityId = "example.com";
     activityState.Actor = new Actor("Example", "mailto:[email protected]");
     activityState.Body = "This is a test input.";
     activityState.StateId = "Bananas";
     bool overwrite = false;
     ActivityState previousState = null;
     target.SaveActivityState(activityState, overwrite, previousState);
     Assert.Inconclusive(INCONCLUSIVE);
 }
        public void ActivityStateTest()
        {
            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[] stateIds = { "The Lion King", "The Fallen King", "The New King" };
            string[] stateContents = {
                "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." };

            string activityId = "example.com/TheLionKing";
            string[] results = target.GetActivityStateIds(activityId, actor);

            //Assert.AreEqual(0, results.Length);

            ActivityState state = new ActivityState();
            state.ActivityId = activityId;
            state.Actor = actor;
            state.StateId = stateIds[0];
            state.Body = stateContents[0];

            ActivityState previous = new ActivityState();
            previous.ActivityId = activityId;
            previous.Actor = actor;
            previous.StateId = stateIds[0];
            previous.Body = stateContents[0];

            target.SaveActivityState(state, false, previous);

            //target.SaveActivityState(state);

            state.StateId = stateIds[1];
            state.Body = stateContents[1];
            target.SaveActivityState(state);

            state.StateId = stateIds[2];
            state.Body = stateContents[2];
            target.SaveActivityState(state);

            results = target.GetActivityStateIds(activityId, actor);

            Assert.AreEqual(3, results.Length);

            ActivityState asResult = target.GetActivityState(activityId, actor, stateIds[0]);
            Assert.AreEqual(stateContents[0], asResult.Body);
            asResult = target.GetActivityState(activityId, actor, stateIds[0]);

            asResult = target.GetActivityState(activityId, actor, stateIds[1]);
            Assert.AreEqual(stateContents[1], asResult.Body);

            asResult = target.GetActivityState(activityId, actor, stateIds[2]);
            Assert.AreEqual(stateContents[2], asResult.Body);

            /*
            target.DeleteActivityState(activityId, actor, stateIds[0]);
            results = target.GetActivityStateIds(activityId, actor);

            Assert.AreEqual(2, results.Length);
            target.DeleteActivityState(activityId, actor, stateIds[1]);
            target.DeleteActivityState(activityId, actor, stateIds[2]);
            */
            results = target.GetActivityStateIds(activityId, actor);
        }