コード例 #1
0
 public void can_resolve_absolute_and_relative_positions()
 {
     sut = Builder.newPlaylist();
     sut.append(ObjectMother.RandomAirplay());
     sut.append(new Section());
     sut.append(ObjectMother.RandomAirplay());
     Assert.AreEqual(1, sut.getAirplayAt(1).RelativePosition);
     Assert.AreEqual(1, sut.getAirplayAt(2).RelativePosition);
     Assert.AreEqual(1, sut.getAirplayAt(1).Section.Position);
     Assert.AreEqual(2, sut.getAirplayAt(2).Section.Position);
 }
コード例 #2
0
ファイル: Builder.cs プロジェクト: bjornebjornson/gema2010
 // TODO: there is a hidden validity-rule here: Playlist must/will/should always have at least one Section
 public static Playlist newPlaylist()
 {
     var p = new Playlist();
     p.append(new Section());
     return p;
 }
コード例 #3
0
 public void can_move_Section()
 {
     sut = Builder.newPlaylist("p1");
     sut.getSectionAt(1).Name = "s1";
     sut.append(new Section { Name = "s2" });
     using(var s = sf.OpenSession())
     using(var t = s.BeginTransaction()) {
         s.Save(sut);
         t.Commit();
     }
     using(var s = sf.OpenSession())
     using(var t = s.BeginTransaction()) {
         var p = s.Load<Playlist>(sut.Id);
         p.moveSection(1, 2);
         t.Commit();
     }
     using(var s = sf.OpenSession()) {
         var playlists = s.Query<Playlist>().ToList();
         Assert.AreEqual(1, playlists.Count);
         Assert.AreEqual("s2", playlists.Single().getSectionAt(1).Name);
         Assert.AreEqual("s1", playlists.Single().getSectionAt(2).Name);
     }
 }
コード例 #4
0
 public void sup()
 {
     sut = Builder.newPlaylist("p1");
     //sut.getSectionAt(1).Name = "s1";
     var iteration = 1;
     while(sut.Airplays.Count() < 5) {
         sut.append(ObjectMother.RandomAirplay("t" + iteration));
         iteration++;
     }
 }