示例#1
0
 public void AddSongToPerformer_WhenBothAreValidAndEnrolled()
 {
     stage.AddPerformer(performer);
     stage.AddSong(song);
     Assert.AreEqual(stage.AddSongToPerformer(song.Name, performer.FullName),
                     $"{song} will be performed by {performer}");
 }
示例#2
0
 public void AddSongToPerformerThrows_When_Null(string songName, string performerName)
 {
     Assert.That(() =>
     {
         stage.AddSongToPerformer(songName, performerName);
     }, Throws.ArgumentNullException);
 }
示例#3
0
        public void AddSongToPerformer_ThrowsEx_PerformerNull()
        {
            stage.AddSong(song);
            Exception ex = Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer(song.Name, performer.FullName));

            Assert.AreEqual(ex.Message, "There is no performer with this name.");
        }
示例#4
0
 public void AddSongToPerformerNullSong()
 {
     song = null;
     Assert.Throws <ArgumentException>(() =>
     {
         stage.AddSongToPerformer("123", performer.FullName);
     });
 }
示例#5
0
        public void AddSongToPerformerThrowsAnExceptionWhenPerformerIsNotPresentInTheCollection()
        {
            Song song = new Song("Song", new TimeSpan(0, 2, 34));

            stage.AddSong(song);

            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer(song.Name, "Performer"));
        }
示例#6
0
        public void Test_AddSongToPerformer()
        {
            stage.AddPerformer(performer);
            stage.AddSong(song);
            var message = stage.AddSongToPerformer(song.Name, performer.FullName);

            Assert.AreEqual(message, $"{song.Name} will be performed by {performer.FullName}");
        }
        public void AddSongToPerformer_GetPerformer()
        {
            stage.AddPerformer(performer);
            stage.AddSong(song);

            var message = stage.AddSongToPerformer(song.Name, performer.FullName);

            Assert.AreEqual($"{song} will be performed by {performer}", message);
        }
        public void AddSongToPerfomer_Work()
        {
            stage.AddSong(song);
            stage.AddPerformer(performer);
            string result = stage.AddSongToPerformer("Game", "Angel Dany");

            Assert.AreEqual(result, $"{song.ToString()} will be performed by {performer.FullName}");
            Assert.AreEqual(performer.SongList.Count, 1);
        }
示例#9
0
        public void AddSong_SongShoultExist()
        {
            //var performer = new Performer("Ivan", "Ivanov", 23);
            //var song = new Song("Hello", new TimeSpan(0, 10, 55));
            stage.AddSong(song);
            stage.AddPerformer(performer);
            stage.AddSongToPerformer(song.Name, performer.FullName);
            var found = performer.SongList.FirstOrDefault(s => s.Equals(song));

            Assert.That(found, Is.EqualTo(song));
        }
        public void TestAddSongToPerformer()
        {
            var message = stage.AddSongToPerformer("Ветрове", "Ivan Ivanov");

            Assert.AreEqual("Ветрове (03:30) will be performed by Ivan Ivanov", message);

            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer("s", "Ivan Ivanov"));
            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer("Ветрове", "Ivan 2"));

            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer("Ветрове", null));
            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer(null, "Ivan Ivanov"));
        }
示例#11
0
        public void Add_Song_To_Performer_Should_Throw_An_Exception_If_The_Song_Is_Not_Existing()
        {
            var stage = new Stage();

            stage.AddPerformer(new Performer("Ri", "a", 20));

            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer("Frog", "Ri a"));
        }
示例#12
0
        public void GetSong()
        {
            Stage     stage     = new Stage();
            Performer performer = new Performer("name", "lastName", 19);

            stage.AddPerformer(performer);

            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer("nameS", "name" + " " + "lastName"));
        }
示例#13
0
        public void GetPerformer()
        {
            Stage stage = new Stage();
            Song  song  = new Song("nameS", new TimeSpan(0, 3, 50));

            stage.AddSong(song);

            Assert.Throws <ArgumentException>(() => stage.AddSongToPerformer("nameS", "name" + " " + "lastName"));
        }
示例#14
0
        public void PlayMethod()
        {
            stage = new Stage();
            Performer perform = new Performer("123", "234", 43);

            stage.AddPerformer(perform);
            stage.AddSong(song);
            stage.AddSongToPerformer("SongTest", "123 234");
            Song newSong = new Song("song", new TimeSpan(0, 4, 0));

            stage.AddSong(newSong);

            stage.AddSongToPerformer("song", "123 234");



            Assert.AreEqual(stage.Play(), $"1 performers played 2 songs");
        }
示例#15
0
        public void Add_Song_To_Performer_Should_Be_Add_Successfully()
        {
            var stage = new Stage();

            stage.AddSong(new Song("A", new TimeSpan(0, 3, 21)));
            stage.AddPerformer(new Performer("Ivan", "Ivanov", 30));

            stage.AddSongToPerformer("A", "Ivan Ivanov");
        }
示例#16
0
        public void AddSongToPerformer_SongIsNull()
        {
            Stage stage = new Stage();

            Performer performer = new Performer("Gosho", "Petkov", 20);

            stage.AddPerformer(performer);

            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer(null, performer.FullName));
        }
示例#17
0
        public void AddSongToPerformer_PerformerIsNull()
        {
            Stage stage = new Stage();

            Song song = new Song("RickRoll", new TimeSpan(0, 1, 30));

            stage.AddSong(song);

            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer(song.Name, null));
        }
示例#18
0
        public void AddSongToPerformerShouldAddCorect()
        {
            this.stage.AddPerformer(this.performer);
            this.stage.AddSong(this.song);


            string expected =   $"{song} will be performed by {performer}";
            Assert.AreEqual(expected, stage.AddSongToPerformer(song.Name, performer.FullName));

            Assert.AreEqual(1, this.performer.SongList.Count);
        }
示例#19
0
        public void PlayMethod()
        {
            Stage     stage     = new Stage();
            Song      song      = new Song("nameS", new TimeSpan(0, 3, 50));
            Performer performer = new Performer("name", "lastName", 19);

            stage.AddPerformer(performer);
            stage.AddSong(song);
            stage.AddSongToPerformer("nameS", "name" + " " + "lastName");

            Assert.AreEqual("1 performers played 1 songs", stage.Play());;
        }
示例#20
0
        public void Play_Should_Return_Correct_Result()
        {
            var stage = new Stage();

            stage.AddSong(new Song("A", new TimeSpan(0, 3, 24)));
            stage.AddPerformer(new Performer("Ivan", "Ivanov", 30));
            stage.AddSongToPerformer("A", "Ivan Ivanov");

            var result = stage.Play();

            Assert.That(result, Is.EqualTo($"1 performers played 1 songs"));
        }
示例#21
0
        public void AddSongToPerformer_ThrowException_WhenNullSong()
        {
            string performerName = "Name";
            string songName      = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                stage.AddSongToPerformer(songName, performerName);
            });
        }
示例#22
0
        public void AddSongToPerformerListText()
        {
            Stage     stage     = new Stage();
            Song      song      = new Song("nameS", new TimeSpan(0, 3, 50));
            Performer performer = new Performer("name", "lastName", 19);

            stage.AddPerformer(performer);
            stage.AddSong(song);

            string result = stage.AddSongToPerformer("nameS", "name" + " " + "lastName");

            Assert.AreEqual("nameS (03:50) will be performed by name lastName", result);
        }
示例#23
0
        public void addnullSongThtheprefomernrows()
        {
            var s = new Stage();
            var p = new Performer("alp", "aa", 22);

            s.AddPerformer(p);
            var sibg = new Song("asd", new TimeSpan(0, 0, 5, 0, 0));

            s.AddSong(sibg);
            var e = s.AddSongToPerformer("asd", "alp aa");

            Assert.AreEqual(e, "asd (05:00) will be performed by alp aa");
        }
示例#24
0
        public void AddSongToPerformerCannotAcceptNullSongNameAndNullPerformerName()
        {
            string song = null;
            string perf = null;

            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer(song, "perf"));
            Assert.Throws <ArgumentNullException>(() => stage.AddSongToPerformer("song", perf));
        }
示例#25
0
        public void AddSongToPerformerList()
        {
            Stage     stage     = new Stage();
            Song      song      = new Song("nameS", new TimeSpan(0, 3, 50));
            Performer performer = new Performer("name", "lastName", 19);

            stage.AddPerformer(performer);
            stage.AddSong(song);

            stage.AddSongToPerformer("nameS", "name" + " " + "lastName");

            int songCount = performer.SongList.Count();

            Assert.AreEqual(songCount, 1);
        }
示例#26
0
        public void MethodAddSongToPerformerThrowExceptionIfOneOfTheGivenValuesDoesNotExist(string performerName, string songName)
        {
            //Arrange
            Stage     stage     = new Stage();
            Performer performer = new Performer("Pesho", "Peshov", 19);
            Song      song      = new Song("Song", TimeSpan.FromSeconds(500));

            //Act
            stage.AddPerformer(performer);
            stage.AddSong(song);

            //Act - Assert
            Assert.Throws <ArgumentException>(()
                                              => stage.AddSongToPerformer(songName, performerName));
        }
示例#27
0
        public void MethodAddSongToPerformerShouldThrowExceptionIfValueIsNull(string performerName, string songName)
        {
            //Arrange
            Stage     stage     = new Stage();
            Performer performer = new Performer("Pesho", "Peshov", 19);
            Song      song      = new Song("Song", TimeSpan.FromSeconds(500));

            //Act
            stage.AddPerformer(performer);
            stage.AddSong(song);

            //Assert
            Assert.Throws <ArgumentNullException>(()
                                                  => stage.AddSongToPerformer(songName, performerName));
        }
示例#28
0
        public void MethodAddSongToPerformerShouldReturnTheCorrectString()
        {
            //Arrange
            Stage     stage     = new Stage();
            Performer performer = new Performer("Pesho", "Peshov", 19);
            Song      song      = new Song("Song", TimeSpan.FromSeconds(500));

            //Act
            stage.AddPerformer(performer);
            stage.AddSong(song);
            var expectedResult = $"{song} will be performed by {performer}";
            var actualResult   = stage.AddSongToPerformer("Song", "Pesho Peshov");

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#29
0
        public void Play_Properly()
        {
            Stage stage = new Stage();

            Song song = new Song("RickRoll", new TimeSpan(0, 1, 30));

            stage.AddSong(song);
            Performer performer = new Performer("Gosho", "Petkov", 20);

            stage.AddPerformer(performer);
            stage.AddSongToPerformer(song.Name, performer.FullName);

            string expectedMessage = "1 performers played 1 songs";

            Assert.AreEqual(expectedMessage, stage.Play());
        }
示例#30
0
        public void AddSongToPerformer_Properly()
        {
            Stage stage = new Stage();
            Song  song  = new Song("RickRoll", new TimeSpan(0, 1, 30));

            stage.AddSong(song);
            Performer performer = new Performer("Gosho", "Petkov", 20);

            stage.AddPerformer(performer);

            stage.AddSongToPerformer(song.Name, performer.FullName);

            Performer performerToCheck = stage.Performers.FirstOrDefault(x => x.FullName == performer.FullName);

            Assert.AreNotEqual(null, performerToCheck);
        }