Пример #1
0
        public void TestAddInject()
        {
            BmpSong songA = new BmpSong()
            {
                Id = ObjectId.NewObjectId()
            };

            BmpSong songB = new BmpSong()
            {
                Id = ObjectId.NewObjectId()
            };

            BmpSong songC = new BmpSong()
            {
                Id = ObjectId.NewObjectId()
            };

            BmpPlaylistDecorator test = CreateTestPlaylist();

            var objRef = test.GetBmpPlaylist();

            ((IPlaylist)test).Add(songA);
            ((IPlaylist)test).Add(songB);

            Assert.AreEqual(2, objRef.Songs.Count);
            Assert.AreSame(songA, objRef.Songs[0]);
            Assert.AreSame(songB, objRef.Songs[1]);

            ((IPlaylist)test).Add(1, songC);

            Assert.AreEqual(3, objRef.Songs.Count);
            Assert.AreSame(songA, objRef.Songs[0]);
            Assert.AreSame(songC, objRef.Songs[1]);
            Assert.AreSame(songB, objRef.Songs[2]);
        }
Пример #2
0
        public void TestNaming()
        {
            BmpPlaylistDecorator test = CreateTestPlaylist();

            Assert.AreEqual(TEST_PLAYLIST_NAME, ((IPlaylist)test).GetName());

            string newName = TEST_PLAYLIST_NAME + " Version 2";

            ((IPlaylist)test).SetName(newName);
            Assert.AreEqual(newName, ((IPlaylist)test).GetName());
        }
Пример #3
0
        public void TestAddAppend()
        {
            BmpSong songA = new BmpSong()
            {
                Id = ObjectId.NewObjectId()
            };

            BmpPlaylistDecorator test = CreateTestPlaylist();

            var objRef = test.GetBmpPlaylist();

            Assert.AreEqual(0, objRef.Songs.Count);

            ((IPlaylist)test).Add(songA);
            Assert.AreEqual(1, objRef.Songs.Count);
            Assert.AreSame(songA, objRef.Songs[0]);
        }