public void PerformSets_ShouldReturnCorrectMessage()
        {
            var stage      = new Stage();
            var controller = new SetController(stage);

            var set3 = new Long("Long");

            stage.AddSet(set3);

            var perf1 = new Performer("Pesho", 23);

            perf1.AddInstrument(new Guitar());
            var perf3 = new Performer("Gosho", 25);

            perf3.AddInstrument(new Microphone());
            set3.AddPerformer(perf1);
            set3.AddPerformer(perf3);

            var song1 = new Song("6days", new TimeSpan(0, 01, 01));
            var song2 = new Song("Vetrove", new TimeSpan(0, 02, 02));
            var song3 = new Song("Despacito", new TimeSpan(0, 03, 03));

            set3.AddSong(song1);
            set3.AddSong(song2);
            set3.AddSong(song3);

            var expected = new StringBuilder();

            expected.AppendLine("1. Long:");
            expected.AppendLine("-- 1. 6days (01:01)");
            expected.AppendLine("-- 2. Vetrove (02:02)");
            expected.AppendLine("-- 3. Despacito (03:03)");
            expected.AppendLine("-- Set Successful");

            var result = controller.PerformSets();

            Assert.AreEqual(expected.ToString().Trim(), result);
        }
        public void Test3()
        {
            var set1 = new Long("Set1");
            var ivan = new Performer("Ivan", 23);

            IInstrument instrument = new Drums();

            ivan.AddInstrument(instrument);
            set1.AddPerformer(ivan);
            set1.AddSong(new Song("Song1", new TimeSpan(00, 01, 00)));

            var stage = new Stage();

            stage.AddSet(set1);

            var sc = new SetController(stage);

            sc.PerformSets();
            var actual   = instrument.Wear;
            var expected = 80;

            Assert.That(actual, Is.EqualTo(expected));
        }
        public void PerformSetsShouldDecreaseInstrumentsWear()
        {
            IStage        stage         = new Stage();
            SetController setController = new SetController(stage);
            ISet          set           = new Short("set1");

            stage.AddSet(set);

            IPerformer  performer  = new Performer("goshkata", 21);
            IInstrument instrument = new Guitar();

            performer.AddInstrument(instrument);
            ISong song = new Song("ssong1", new System.TimeSpan(0, 2, 0));

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

            setController.PerformSets();
            double actualWear   = instrument.Wear;
            double expectedWear = 40;

            Assert.That(actualWear == expectedWear);
        }
        public void Test()
        {
            IStage         stage         = new Stage();
            ISetController setController = new SetController(stage);

            IPerformer perfomer = new Performer("Pesho", 12);

            stage.AddPerformer(perfomer);

            ISong song = new Song("Killshot", new TimeSpan(0, 0, 3, 55));

            stage.AddSong(song);

            ISet set = new Long("Set1");

            set.AddPerformer(perfomer);
            set.AddSong(song);
            stage.AddSet(set);

            string result = setController.PerformSets();

            Assert.AreEqual("1. Set1:\r\n-- Did not perform", result);
        }
        public void CheckMinutes()
        {
            IStage stage = new Stage();

            ;
            ISet set1 = new Short("ShortSet1");
            ISet set2 = new Short("ShortSet2");
            ISet set3 = new Short("ShortSet3");

            SetController setController = new SetController(stage);

            var sb = new StringBuilder();

            Song song1 = new Song("TestSong", new System.TimeSpan(0, 15, 0));
            Song song2 = new Song("TestSong", new System.TimeSpan(0, 15, 0));
            Song song3 = new Song("TestSong", new System.TimeSpan(0, 15, 0));

            stage.AddSong(song1);
            stage.AddSong(song2);
            stage.AddSong(song3);

            setController.PerformSets();
        }
Beispiel #6
0
        public void TestControllerPerformSetSuccessful()
        {
            var set1       = new Short("set1");
            var performer  = new Performer("Danny", 38);
            var instrument = new Guitar();

            performer.AddInstrument(instrument);
            var song = new Song("name", new TimeSpan(0, 0, 5, 0));

            var stage = new Stage();

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

            var controller   = new SetController(stage);
            var stringOutput = controller.PerformSets();
            var expected     = "1. set1:" + Environment.NewLine + "-- 1. name (05:00)" + Environment.NewLine + "-- Set Successful";

            Assert.AreEqual(expected, stringOutput);
        }
Beispiel #7
0
        public void PerformSets_ShouldPerformValidSets()
        {
            IStage         stage      = new Stage();
            ISetController controller = new SetController(stage);

            ISet set = new Short("Set1");

            stage.AddSet(set);

            IPerformer performer = new Performer("Sonny", 22);

            performer.AddInstrument(new Guitar());
            set.AddPerformer(performer);

            ISong song = new Song("Song", new TimeSpan(0, 3, 24));

            set.AddSong(song);

            string actualOutput  = controller.PerformSets();
            string shouldEndWith = "1. Set1:\r\n-- 1. Song (03:24)\r\n-- Set Successful";

            Assert.That(actualOutput, Is.EqualTo(shouldEndWith));
        }
Beispiel #8
0
        public void Test()
        {
            var stage = new Stage();

            stage.AddSet(new Medium(nameof(Medium)));
            stage.AddSet(new Long(nameof(Long)));

            var songName  = "song1";
            var mediumSet = nameof(Medium);
            var longSet   = nameof(Long);

            var performer = new Performer("performer", 22);
            var guitar    = new Guitar();

            performer.AddInstrument(guitar);

            var song = new Song(songName, new System.TimeSpan(0, 2, 22));

            stage.AddSong(song);
            var set = stage.GetSet(mediumSet);

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



            var setController = new SetController(stage);
            var result        = setController.PerformSets().Split(System.Environment.NewLine);

            Assert.IsTrue(result[0] == "1. Medium:");

            Assert.IsTrue(result[2].Contains("Successful"));

            Assert.IsTrue(result[4].Contains("Did not perform"));

            Assert.That(guitar.Wear, Is.EqualTo(40));
        }
        public void AddPerformerToStage()
        {
            IStage stage = new Stage();

            Song song = new Song("TestSong", new System.TimeSpan(0, 15, 0));

            ISet set1 = new Short("ShortSet1");
            ISet set2 = new Short("ShortSet2");
            ISet set3 = new Short("ShortSet3");

            SetController setController = new SetController(stage);

            var sb = new StringBuilder();

            stage.AddSong(song);

            stage.AddSet(set1);
            stage.AddSet(set2);
            stage.AddSet(set3);

            setController.PerformSets();

            Assert.That(stage.Sets.Count, Is.EqualTo(3));
        }
        public void Test3()
        {
            IStage stage = new Stage();

            ISet        set       = new Short("Set1");
            IPerformer  perfomer  = new Performer("Ivan", 20);
            IInstrument instument = new Guitar();

            perfomer.AddInstrument(instument);
            set.AddPerformer(perfomer);

            set.AddSong(new Song("Song1", new TimeSpan(0, 0, 1, 2)));

            stage.AddSet(set);
            ISetController setController = new SetController(stage);

            var beforeValue = instument.Wear;

            setController.PerformSets();

            var afterValue = instument.Wear;

            Assert.That(beforeValue, Is.Not.EqualTo(afterValue));
        }
Beispiel #11
0
        public void SecondTest()
        {
            var stage     = new Stage();
            var guitar    = new Guitar();
            var set       = new Long("Long");
            var song      = new Song("Song", new TimeSpan(0, 1, 0));
            var performer = new Performer("Gosho", 21);

            stage.AddSet(set);
            set.AddPerformer(performer);
            set.AddSong(song);
            stage.AddPerformer(performer);
            stage.AddSong(song);
            performer.AddInstrument(guitar);

            var setController = new SetController(stage);
            var sb            = new StringBuilder();

            sb.AppendLine("1. Long:");
            sb.AppendLine("-- 1. Song (01:00)");
            sb.AppendLine("-- Set Successful");

            Assert.That(setController.PerformSets(), Is.EqualTo(sb.ToString().Trim()));
        }
Beispiel #12
0
        public void TestShoulPerform()
        {
            var set1 = new Short("Set1");
            var set2 = new Medium("Set2");

            var misho = new Performer("Misho", 20);

            misho.AddInstrument(new Guitar());
            var ivo = new Performer("Ivo", 24);

            ivo.AddInstrument(new Drums());
            var minka = new Performer("Minka", 19);

            minka.AddInstrument(new Guitar());
            minka.AddInstrument(new Microphone());

            Song song1 = new Song("Song1", new TimeSpan(0, 1, 2));

            set1.AddSong(song1);
            set1.AddPerformer(ivo);
            set1.AddPerformer(minka);

            stage.AddSet(set1);
            stage.AddSet(set2);

            var expected = @"1. Set1:
                            -- 1. Song1 (01:02)
                            -- Set Successful
                            2. Set2:
                            -- Did not perform";

            var actual = setController.PerformSets();

            Assert.That(expected, Is.EqualTo(actual));
            Assert.That(minka.Instruments.First().Wear, Is.EqualTo(40));
        }
        public void PerformSetsShouldDecreaseInstrumentWear()
        {
            IStage         stage         = new Stage();
            ISetController setController = new SetController(stage);
            ISet           set           = new Short("Set1");
            IPerformer     performer     = new Performer("Pesho", 12);
            IInstrument    instrument    = new Guitar();

            performer.AddInstrument(instrument);
            ISong song = new Song("Song", new TimeSpan(0, 2, 30));

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

            stage.AddSet(set);

            double instrumentWearBeforePerforming = instrument.Wear;

            setController.PerformSets();

            double instrumentWearAfterPerforming = instrument.Wear;

            Assert.That(instrumentWearAfterPerforming, Is.Not.EqualTo(instrumentWearBeforePerforming));
        }
        public void SetShouldPerformSuccessfully()
        {
            Stage         stage         = new Stage();
            SetController setController = new SetController(stage);

            Set set = new Short("Set1");

            Performer performer = new Performer("Pesho", 20);

            performer.AddInstrument(new Guitar());
            set.AddPerformer(performer);

            Song song = new Song("Song1", new System.TimeSpan(0, 2, 30));

            set.AddSong(song);

            stage.AddSet(set);

            string actualResult   = setController.PerformSets();
            string expectedResult = $"1. Set1:\r\n-- 1. Song1 (02:30)\r\n-- Set Successful";

            Assert.AreEqual(expectedResult, actualResult);
            Assert.That(performer.Instruments.All(x => x.Wear < 100), Is.True);
        }
Beispiel #15
0
        public void Test4()
        {
            var stage = new Stage();

            var guitar = new Guitar();


            var performer3 = new Performer("Ivan", 20);

            performer3.AddInstrument(guitar);

            var set2 = new Short("ShortTest");

            set2.AddPerformer(performer3);
            var song4 = new Song("song4", new TimeSpan(0, 0, 1));

            set2.AddSong(song4);
            stage.AddSet(set2);

            var controller = new SetController(stage);
            var result     = controller.PerformSets();

            Assert.That(guitar.Wear < 100);
        }
Beispiel #16
0
        public void Test3()
        {
            var stage = new Stage();

            var guitar = new Guitar();

            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();
            guitar.WearDown();

            var performer3 = new Performer("Ivan", 20);

            performer3.AddInstrument(guitar);

            var set2 = new Short("ShortTest");

            set2.AddPerformer(performer3);
            stage.AddSet(set2);


            var controller = new SetController(stage);
            var result     = controller.PerformSets();

            Assert.That(result, Is.EqualTo("1. ShortTest:\r\n-- Did not perform"));
        }
        public void TestIfInstrumentsWearDown()
        {
            ISet set  = new Short("Set1");
            ISet set2 = new Short("Set2");

            IStage stage = new Stage();

            int      hours1        = 0;
            int      minutes1      = 1;
            int      seconds1      = 2;
            TimeSpan songDuration1 = new TimeSpan(hours1, minutes1, seconds1);

            ISong song = new Song("Song1", songDuration1);

            int      hours2        = 0;
            int      minutes2      = 1;
            int      seconds2      = 2;
            TimeSpan songDuration2 = new TimeSpan(hours2, minutes2, seconds2);

            ISong song2 = new Song("Song2", songDuration2);


            IPerformer performer1 = new Performer("Gosho", 24);
            Drums      drum       = new Drums();

            performer1.AddInstrument(drum);

            IPerformer performer2 = new Performer("Pesho", 19);
            Guitar     guitar     = new Guitar();

            performer2.AddInstrument(guitar);

            set.AddPerformer(performer1);
            set.AddPerformer(performer2);
            set.AddSong(song);
            set.AddSong(song2);

            set2.AddPerformer(performer1);
            set2.AddPerformer(performer2);
            set2.AddSong(song);
            set2.AddSong(song2);

            stage.AddSet(set);
            stage.AddSet(set2);
            stage.AddSong(song);
            stage.AddSong(song2);
            stage.AddPerformer(performer1);
            stage.AddPerformer(performer2);

            SetController setController = new SetController(stage);

            string expectedSet1 = "1. Set1:" + Environment.NewLine + "-- 1. Song1 (01:02)" + Environment.NewLine + "-- 2. Song2 (01:02)" + Environment.NewLine + "-- Set Successful";

            string expectedSet2 = Environment.NewLine + "2. Set2:" + Environment.NewLine + "-- Did not perform";

            string expected = expectedSet1 + expectedSet2;

            string actual = setController.PerformSets();

            Assert.That(actual, Is.EqualTo(expected));
        }