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); }
// 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; }
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); } }
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++; } }