Exemple #1
0
        public void SaveActivityProfileTest()
        {
            TCAPI           target  = new TCAPI(new Uri("http://cloud.scorm.com/tc/public"), new BasicHTTPAuth("test", "password"));
            ActivityProfile profile = new ActivityProfile();

            profile.ProfileId  = "Bananas";
            profile.ActivityId = "example.com";
            profile.Body       = "These are contents";
            bool            overwrite = false;
            ActivityProfile previous  = null;

            target.SaveActivityProfile(profile, overwrite, previous);
            Assert.Inconclusive(INCONCLUSIVE);
        }
Exemple #2
0
        public ActivityManagerTests()
        {
            var activityProfile = new ActivityProfile();
            var configuration   = new MapperConfiguration(cfg => cfg.AddProfile(activityProfile));

            _mapper = new Mapper(configuration);

            _unitOfWorkMock.SetupGet(uow => uow.ActivityRepository).Returns(_activityRepoMock.Object);
            _unitOfWorkMock.SetupGet(uow => uow.ActivityTypeRepository).Returns(_activityTypeRepoMock.Object);

            _activityRepoMock.Setup(repo => repo.Create(It.IsAny <ActivityDbModel>()))
            .Returns <ActivityDbModel>(m => m);

            _activityTypeRepoMock.Setup(repo => repo.Create(It.IsAny <ActivityTypeDbModel>()))
            .Returns <ActivityTypeDbModel>(m => m);

            _unitOfWorkMock.Setup(uow => uow.SaveAsync()).Returns(Task.FromResult(1));

            _target = new ActivityManager(_unitOfWorkMock.Object, _mapper);
        }
Exemple #3
0
        public void ActivityProfileTest()
        {
            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."
            };
            string activityId = "\"example.com/TheLionKing\"";

            string[] actual;
            actual = target.GetActivityProfileIds(activityId);

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

            ActivityProfile profile = new ActivityProfile();

            profile.ActivityId = activityId;
            profile.ProfileId  = profileIds[0];
            profile.Body       = profileContents[0];
            ActivityProfile pp = new ActivityProfile();

            pp.ActivityId = activityId;
            pp.ProfileId  = profileIds[0];
            pp.Body       = profileContents[0];

            target.SaveActivityProfile(profile, true, pp);

            profile.ProfileId = profileIds[1];
            profile.Body      = profileContents[1];

            target.SaveActivityProfile(profile);

            profile.ProfileId = profileIds[2];
            profile.Body      = profileContents[2];

            target.SaveActivityProfile(profile);

            /*
             * ActivityProfile previous = new ActivityProfile();
             * previous.ProfileId = profileIds[2];
             * previous.Body = profileContents[1];
             *
             * target.SaveActivityProfile(profile, false, previous);
             */

            actual = target.GetActivityProfileIds(activityId);
            Assert.AreEqual(3, actual.Length);

            ActivityProfile apResult = target.GetActivityProfile(activityId, profileIds[0]);

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

            apResult = target.GetActivityProfile(activityId, profileIds[1]);
            Assert.AreEqual(profileContents[1], apResult.Body);

            apResult = target.GetActivityProfile(activityId, profileIds[2]);
            Assert.AreEqual(profileContents[2], apResult.Body);

            target.DeleteActivityProfile(activityId, profileIds[0]);
            actual = target.GetActivityProfileIds(activityId);
            Assert.AreEqual(2, actual.Length);

            target.DeleteAllActivityProfile(activityId);
            actual = target.GetActivityProfileIds(activityId);
            Assert.AreEqual(0, actual.Length);
        }
Exemple #4
0
 public User(string name, OwnerShipType ownershiptype, ActivityProfile acitvityProfile, Person contactPerson,
             Country country, City city, Location location, string email)
 {
     OwnershipType   = ownershiptype;
     ActivityProfile = acitvityProfile;
 }