Ejemplo n.º 1
0
 public void TestGuidReplacement(string before, string after, Guid guid1, Guid guid2)
 {
     var clip = new YoutubeClip { Description = before + "\n" + YoutubeClip.GuidMarker(guid1) + "\n" + after };
     clip.UpdateGuid(guid2);
     var expected = before + "\n" + YoutubeClip.GuidMarker(guid2) + "\n" + after;
     Assert.AreEqual(expected,clip.Description);
 }
Ejemplo n.º 2
0
 public void TestGuidAddition(string desc, Guid guid)
 {
     var clip = new YoutubeClip { Description = desc };
     clip.UpdateGuid(guid);
     string expected = desc + "\n" + "[GUID: " + guid + "]";
     Assert.AreEqual(expected, clip.Description);
 }
Ejemplo n.º 3
0
        void InitializeDueNames()
        {
            var prefix      = "";
            var description = "";

            prefix += Source.Model.Settings.CourseAbbreviation;
            var path = Wrap.PathFromRoot.Skip(1).ToArray();

            for (int levelNumber = 0; levelNumber < path.Length; levelNumber++)
            {
                TopicLevel level = new TopicLevel();
                if (levelNumber < Source.Model.Settings.TopicLevels.Count)
                {
                    level = Source.Model.Settings.TopicLevels[levelNumber];
                }
                prefix += "-";
                prefix += string.Format("{0:D" + level.Digits + "}", path[levelNumber].NumberInTopic + 1);

                var topic = path[levelNumber] as FolderOrLectureItem;
                if (topic != null && Source.Model.Settings.EnableDescriptionContents)
                {
                    description += level.Caption + " " + (path[levelNumber].NumberInTopic + 1) + ". " + topic.Topic.Caption + "\r\n";
                }
            }

            dueTitle     = prefix + " " + Wrap.Video.Name;
            description += Source.Model.Settings.Description;
            if (!string.IsNullOrEmpty(Source.Model.Settings.ULearnUrlPrefix))
            {
                description += "\n\n" + Source.Model.Settings.ULearnUrlPrefix + Wrap.Guid;
            }
            description   += "\n\n" + YoutubeClip.GuidMarker(Wrap.Guid);
            dueDescription = description;
        }
Ejemplo n.º 4
0
        public void CmPush()
        {
            var YoutubeClip = Wrap.Get <YoutubeClip>();

            if (YoutubeClip == null)
            {
                return;
            }
            var clip = new YoutubeClip {
                Id = YoutubeClip.Id
            };

            clip.Name        = dueTitle;
            clip.Description = dueDescription;

            clip.UpdateGuid(Wrap.Guid);
            YoutubeApisProcessor.Current.UpdateVideo(clip);
            Wrap.Store <YoutubeClip>(clip);
            MakeChange();
        }
Ejemplo n.º 5
0
 public void TestPrefix(string prefix, string result)
 {
     var clip = new YoutubeClip { Name = prefix + result };
     Assert.AreEqual(result, clip.GetProperName());
 }
Ejemplo n.º 6
0
 public void TestGuidDeletion(string before, string after, Guid guid)
 {
     var clip = new YoutubeClip { Description = before + "\n" + YoutubeClip.GuidMarker(guid) + "\n" + after };
     clip.UpdateGuid(null);
     Assert.AreEqual(before + "\n\n" + after, clip.Description);
 }