Beispiel #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}");
 }
Beispiel #2
0
 public void AddSongToPerformerThrows_When_Null(string songName, string performerName)
 {
     Assert.That(() =>
     {
         stage.AddSongToPerformer(songName, performerName);
     }, Throws.ArgumentNullException);
 }
Beispiel #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.");
        }
Beispiel #4
0
 public void AddSongToPerformerNullSong()
 {
     song = null;
     Assert.Throws <ArgumentException>(() =>
     {
         stage.AddSongToPerformer("123", performer.FullName);
     });
 }
Beispiel #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"));
        }
Beispiel #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);
        }
Beispiel #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"));
        }
Beispiel #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"));
        }
Beispiel #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"));
        }
Beispiel #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"));
        }
Beispiel #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");
        }
Beispiel #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");
        }
Beispiel #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));
        }
Beispiel #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));
        }
        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);
        }
Beispiel #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());;
        }
Beispiel #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"));
        }
Beispiel #21
0
        public void AddSongToPerformer_ThrowException_WhenNullSong()
        {
            string performerName = "Name";
            string songName      = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                stage.AddSongToPerformer(songName, performerName);
            });
        }
Beispiel #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);
        }
Beispiel #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");
        }
Beispiel #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));
        }
Beispiel #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);
        }
        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));
        }
        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));
        }
        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);
        }
Beispiel #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());
        }
Beispiel #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);
        }