public void PerformCommandReturnsSuccessResult() { IStage stage = new Stage(); ISet set = new Short("Set1"); TimeSpan duration = TimeSpan.FromSeconds((1 * 60) + 2); ISong song = new Song("Song1", duration); IPerformer performer = new Performer("Gosho", 20); performer.AddInstrument(new Guitar()); set.AddPerformer(performer); set.AddSong(song); stage.AddSong(song); stage.AddSet(set); stage.AddSong(song); stage.AddPerformer(performer); ISetController setController = new SetController(stage); string actual = "1. Set1:\r\n-- 1. Song1 (01:02)\r\n-- Set Successful"; string expected = setController.PerformSets(); Assert.AreEqual(actual, expected); }
public void Stage_AddSong_ThrowsEx_Validator() { song = null; Exception ex = Assert.Throws <ArgumentNullException>(() => stage.AddSong(song)); Assert.AreEqual(ex.Message, "Can not be null! (Parameter 'song')"); }
public void TestInstrumentsGetBroken() { IStage stage = new Stage(); ISet set = new Short("Set1"); TimeSpan duration = TimeSpan.FromSeconds((1 * 60) + 2); ISong song = new Song("Song1", duration); IPerformer performer = new Performer("Gosho", 20); IInstrument instrument = new Guitar(); instrument.WearDown(); instrument.WearDown(); performer.AddInstrument(instrument); set.AddPerformer(performer); set.AddSong(song); stage.AddSong(song); stage.AddSet(set); stage.AddSong(song); stage.AddPerformer(performer); ISetController setController = new SetController(stage); string actual = "1. Set1:\r\n-- Did not perform"; string expected = setController.PerformSets(); Assert.AreEqual(actual, expected); }
public void AddSongThrows_When_Null() { Assert.That(() => { stage.AddSong(null); }, Throws.ArgumentNullException); }
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 AddSong() { Exception ex = Assert.Throws <ArgumentException>(() => { stage.AddSong(new Song("idk", new TimeSpan(0, 0, 30))); }); Assert.AreEqual(ex.Message, "You can only add songs that are longer than 1 minute."); }
public void RegisterSetTest() { ISet set = new Short("Set1"); 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(); Drums drum2 = new Drums(); performer2.AddInstrument(guitar); set.AddPerformer(performer1); set.AddPerformer(performer2); set.AddSong(song); set.AddSong(song2); stage.AddSet(set); stage.AddSong(song); stage.AddSong(song2); stage.AddPerformer(performer1); stage.AddPerformer(performer2); SetController setController = new SetController(stage); string expected = "1. Set1:" + Environment.NewLine + "-- 1. Song1 (01:02)" + Environment.NewLine + "-- 2. Song2 (01:02)" + Environment.NewLine + "-- Set Successful"; string actual = setController.PerformSets(); Assert.That(actual, Is.EqualTo(expected)); }
public void Check_PrivateValidator_ForAddSong() { Assert.Throws <ArgumentNullException>(() => { stage.AddSong(null); }); }
public void TestPerformanceSuccessful() { IStage stage = new Stage(); ISet set = new Short("Shorty"); stage.AddSet(set); IPerformer perf = new Performer("HrupHrupAzSumTup", 22); perf.AddInstrument(new Guitar()); stage.AddPerformer(perf); ISong song = new Song("hrup", new System.TimeSpan(0, 5, 0)); stage.AddSong(song); set.AddSong(song); set.AddPerformer(perf); ISetController setController = new SetController(stage); setController.PerformSets(); Assert.That(() => setController.PerformSets(), Is.EqualTo("1. Shorty:\r\n" + "-- 1. hrup (05:00)\r\n" + "-- Set Successful")); }
public void TestInstrumentWearsDownAfterPerformance() { IStage stage = new Stage(); ISet set = new Short("Shorty"); stage.AddSet(set); IPerformer perf = new Performer("HrupHrupAzSumTup", 22); perf.AddInstrument(new Guitar()); stage.AddPerformer(perf); ISong song = new Song("hrup", new System.TimeSpan(0, 5, 0)); stage.AddSong(song); set.AddSong(song); set.AddPerformer(perf); ISetController setController = new SetController(stage); setController.PerformSets(); Assert.That(perf.Instruments.First().Wear, Is.EqualTo(40)); }
public void Test2() { var stage = new Stage(); stage.AddSet(new Medium(nameof(Medium))); var songName = "song1"; var mediumSet = nameof(Medium); 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.AddSong(song); set.AddSong(song); set.AddSong(song); set.AddSong(song); set.AddPerformer(performer); var setController = new SetController(stage); var result = setController.PerformSets().Split(System.Environment.NewLine); }
public void Test() { IStage stage = new Stage(); ISetController setController = new SetController(stage); //IInstrument instrument = new Guitar(); IPerformer performer = new Performer("Gosho", 24); //performer.AddInstrument(instrument); stage.AddPerformer(performer); ISong song = new Song("Rocks down", new TimeSpan(0, 0, 0, 55)); stage.AddSong(song); ISet set = new Long("Set1"); set.AddPerformer(performer); set.AddSong(song); stage.AddSet(set); string result = setController.PerformSets(); Assert.AreEqual("1. Set1:\r\n-- Did not perform", result); }
public void AddSong_SmallSong() { Stage stage = new Stage(); Song song = new Song("RickRoll", new TimeSpan(0, 0, 30)); Assert.Throws <ArgumentException>(() => stage.AddSong(song)); }
public void Ctor_ProperInit() { Stage stage = new Stage(); Assert.AreNotEqual(null, stage.Performers); Assert.DoesNotThrow(() => stage.AddSong(new Song("Gosho", new TimeSpan(1, 0, 0)))); }
public void PerforSetsTest() { IStage stage = new Stage(); ISetController setController = new SetController(stage); ISet set = new Short("Set1"); ISet set2 = new Short("Set2"); stage.AddSet(set); stage.AddSet(set2); IPerformer performer = new Performer("Pesho", 23); IInstrument guitar = new Guitar(); stage.AddPerformer(performer); set.AddPerformer(performer); performer.AddInstrument(guitar); ISong song = new Song("Song1", new System.TimeSpan(0, 5, 0)); stage.AddSong(song); set.AddSong(song); string expectedResult = "1. Set1:" + "\r\n" + "-- 1. Song1 (05:00)" + "\r\n" + "-- Set Successful" + "\r\n" + "2. Set2:" + "\r\n" + "-- Did not perform"; string actualResult = setController.PerformSets(); Assert.That(actualResult, Is.EqualTo(expectedResult).NoClip); Assert.That(guitar.Wear, Is.EqualTo(40)); }
public void SetControllerShouldReturnSuccessMessage() { var stage = new Stage(); var performer = new Performer("Ivo", 26); IInstrument instrument = new Guitar(); performer.AddInstrument(instrument); stage.AddPerformer(performer); // ISong song = new Song("Chico loco", new TimeSpan(0, 2, 30)); stage.AddSong(song); // ISet set = new Short("ShortSet"); stage.AddSet(set); var setController = new SetController(stage); var actualResult = setController.PerformSets(); var expectedResult = "1. ShortSet:\r\n-- Did not perform"; Assert.AreEqual(expectedResult, actualResult); }
public void TestCanPerformReturnsTrue() { IStage stage = new Stage(); ISet set = new Short("Shorty"); stage.AddSet(set); IPerformer perf = new Performer("HrupHrupAzSumTup", 22); perf.AddInstrument(new Guitar()); stage.AddPerformer(perf); ISong song = new Song("hrup", new System.TimeSpan(0, 5, 0)); stage.AddSong(song); set.AddSong(song); set.AddPerformer(perf); ISetController setController = new SetController(stage); setController.PerformSets(); Assert.That(() => stage.Sets.First().CanPerform(), Is.EqualTo(true)); }
public void SetControllerShouldWearDownInstruments() { Performer performer = new Performer("Ivo", 26); IInstrument instrument = new Guitar(); performer.AddInstrument(instrument); ISet set = new Short("ShortSet"); set.AddPerformer(performer); ISong song = new Song("Chico loco", new TimeSpan(0, 2, 30)); set.AddSong(song); var stage = new Stage(); stage.AddPerformer(performer); stage.AddSong(song); stage.AddSet(set); var setController = new SetController(stage); var instrumentWearBefore = instrument.Wear; setController.PerformSets(); var instrumentWearAfter = instrument.Wear; Assert.AreNotEqual(instrumentWearAfter, instrumentWearBefore); }
public void TestWhetherTheControllerFailsToPerform() { var set1 = new Short("set1"); var performer = new Performer("Woah", 39); var instrument = new Microphone(); performer.AddInstrument(instrument); var song = new Song("WoahButSong", 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); controller.PerformSets(); controller.PerformSets(); var stringOutput = controller.PerformSets(); var expectedResult = "1. set1:\r\n-- Did not perform"; Assert.AreEqual(expectedResult, stringOutput); }
public void TestControllerDidNotPerformSetWithBrokenInstruments() { var set1 = new Short("set1"); var performer = new Performer("Danny", 38); var instrument = new Microphone(); 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); controller.PerformSets(); controller.PerformSets(); var stringOutput = controller.PerformSets(); var expected = "1. set1:" + Environment.NewLine + "-- Did not perform"; Assert.AreEqual(expected, stringOutput); }
public void TestWhetherTheControllerGivesCorrectOutput() { var set1 = new Short("set1"); var performer = new Performer("Bat nasko", 30); var instrument = new Guitar(); performer.AddInstrument(instrument); var song = new Song("name", new TimeSpan(0, 0, 10, 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 expectedResult = "1. set1:\r\n-- 1. name (10:00)\r\n-- Set Successful"; Assert.AreEqual(expectedResult, stringOutput); }
public void Test_AddSong_WithInvalidParameters() { var invalidSong = new Song("Panairi", new TimeSpan(0, 0, 30)); var ex = Assert.Throws <ArgumentException>(() => { stage.AddSong(invalidSong); } ); Assert.AreEqual("You can only add songs that are longer than 1 minute.", ex.Message); }
public void Add_Song_Should_Be_Add_Successfully() { var stage = new Stage(); var song = new Song("Smth", new TimeSpan(0, 3, 25)); stage.AddSong(song); }
public void Add_Song_Should_Throw_An_Exception_If_The_Song_Duration_Is_Under_1_Minute() { var stage = new Stage(); var song = new Song("Smth", new TimeSpan(0, 0, 30)); Assert.Throws <ArgumentException>(() => stage.AddSong(song)); }
public void AddNullSongright() { Stage stage = new Stage(); Song song = new Song("asd", new TimeSpan(0, 2, 30)); stage.AddSong(song); Assert.AreEqual(song.Duration, new TimeSpan(0, 2, 30)); }
public static void Main(string[] args) { //example usage of the Stage class var song1 = new Song("Ветрове", new TimeSpan(0, 3, 30)); var song2 = new Song("Бурни Нощи", new TimeSpan(0, 2, 30)); var performer = new Performer("Ivan", "Ivanov", 19); Stage stage = new Stage(); stage.AddSong(song1); stage.AddSong(song2); stage.AddPerformer(performer); Console.WriteLine(stage.AddSongToPerformer("Ветрове", "Ivan Ivanov")); Console.WriteLine(stage.Play()); }
public void AddSongThrowsException() { Stage stage = new Stage(); Song song = new Song("name", new TimeSpan(0, 0, 50)); Assert.Throws <ArgumentException>(() => stage.AddSong(song)); }
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"); }
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"); }
public void AddSongShouldThrowException() { Stage stage = new Stage(); Song song = new Song("wind of change", TimeSpan.MinValue); Assert.That(() => stage.AddSong(song), Throws.ArgumentException); }