Exemplo n.º 1
0
        public void SetControllerPerfosmSetsWearsDownInstruments()
        {
            foreach (var instrument in instruments)
            {
                performer.AddInstrument(instrument);
            }

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

            this.set = new Long("Reeeeeeeeeeeeeeee...");
            this.set.AddSong(song);
            this.set.AddPerformer(performer);

            this.stage.AddSet(set);

            var initialInstrumentWearLevel = instruments.Select(i => i.Wear).ToArray();

            this.setController.PerformSets();

            var actualWearLevel = instruments.Select(i => i.Wear).ToArray();

            for (int i = 0; i < instruments.Length; i++)
            {
                Assert.That(actualWearLevel[i], Is.LessThan(initialInstrumentWearLevel[i]));
            }
        }
        public string SignUpPerformer(string[] args)
        {
            try
            {
                List <string> arguments     = args.ToList();
                string        performerName = arguments[0];
                int           performerAge  = int.Parse(arguments[1]);

                arguments.RemoveAt(0);
                arguments.RemoveAt(0);

                List <IInstrument> performerInstruments = new List <IInstrument>();
                IPerformer         newPerformer         = this.performerFactory.CreatePerformer(performerName, performerAge);

                for (int i = 0; i < arguments.Count; i++)
                {
                    IInstrument newInstrument = this.instrumentFactory.CreateInstrument(arguments[i]);
                    newPerformer.AddInstrument(newInstrument);
                }

                this.stage.AddPerformer(newPerformer);
                return($"Registered performer {performerName}");
            }
            catch
            {
                // not by definition
                return("ERROR signign performer");
            }
        }
Exemplo n.º 3
0
        public string SignUpPerformer(string[] args)
        {
            string performerName = args[0];
            int    performerAge  = int.Parse(args[1]);

            List <string> stringInstruments = args.Skip(2).ToList();

            List <IInstrument> performerInstrumentsToAdd = new List <IInstrument>();

            foreach (var instrument in stringInstruments)
            {
                IInstrument currentInstrumentToAdd = this.instrumentFactory.CreateInstrument(instrument);

                performerInstrumentsToAdd.Add(currentInstrumentToAdd);
            }

            IPerformer performer = this.performerFactory.CreatePerformer(performerName, performerAge);

            foreach (var addInstrument in performerInstrumentsToAdd)
            {
                performer.AddInstrument(addInstrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(Constants.SignUpPerformerSuccessMessage, performerName));
        }
Exemplo n.º 4
0
        public string SignUpPerformer(string[] args)
        {
            string name = args[0];
            int    age  = int.Parse(args[1]);

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            if (args.Length > 2)
            {
                string[] instrumentNames = args.Skip(2).ToArray();

                List <IInstrument> instruments = instrumentNames
                                                 .Select(i => this.instrumentFactory.CreateInstrument(i))
                                                 .ToList();

                foreach (var instrument in instruments)
                {
                    performer.AddInstrument(instrument);
                }
            }

            this.stage.AddPerformer(performer);

            return(string.Format(Constants.SuccessfulSignedPerformer, performer));
        }
Exemplo n.º 5
0
        public string SignUpPerformer(string[] args)
        {
            var name = args[0];
            var age  = int.Parse(args[1]);

            IPerformer performer = performerFactory.CreatePerformer(name, age);

            var instrumetTypes = args.Skip(2).ToArray();

            //List<IInstrument> instrumetsAsObj = null;

            //foreach (string type in instrumetTypes)
            //{
            //    IInstrument instrument = instrumentFactory.CreateInstrument(type);
            //    instrumetsAsObj.Add(instrument);
            //}

            var instrumenti2 = instrumetTypes
                               .Select(i => this.instrumentFactory.CreateInstrument(i))
                               .ToArray();

            foreach (var instrument in instrumenti2)
            {
                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(SignUpPerformerSuccsessully, performer.Name));
        }
        public string SignUpPerformer(string[] args)
        {
            string name = args[0];
            int    age  = int.Parse(args[1]);

            string[] instrumenti = args.Skip(2).ToArray();

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            foreach (var instrumentName in instrumenti)
            {
                IInstrument instrument = this.instrumentFactory.CreateInstrument(instrumentName);

                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(RegisteredPerformerMessage, name));
        }
        public string SignUpPerformer(string[] args)
        {
            string name = args[0];
            int    age  = int.Parse(args[1]);

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            List <string> instrumentNames = args.Skip(2).ToList();

            foreach (string instrumentName in instrumentNames)
            {
                IInstrument instrument = this.instrumentFactory.CreateInstrument(instrumentName);

                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(PerformerSignedUp, name));
        }
        public string SignUpPerformer(string[] args)
        {
            var name = args[0];
            var age  = int.Parse(args[1]);

            var instruments = args.Skip(2).ToArray();

            var instrumentsCreated = instruments
                                     .Select(i => this.instrumentFactory.CreateInstrument(i))
                                     .ToArray();

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            foreach (var instrument in instrumentsCreated)
            {
                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(Messages.PerformerRegistered, name));
        }
Exemplo n.º 9
0
        public string SignUpPerformer(string[] args)
        {
            string name = args[0];
            int    age  = int.Parse(args[1]);

            string[] instrumentsTypes = args.Skip(2).ToArray();

            IInstrument[] instruments = instrumentsTypes
                                        .Select(i => this.instrumentFactory.CreateInstrument(i))
                                        .ToArray();

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            foreach (IInstrument instrument in instruments)
            {
                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return($"Registered performer {performer.Name}");
        }
        public string SignUpPerformer(string[] args)
        {
            string name = args[1];
            int    age  = int.Parse(args[2]);

            string[] instrumentArgs = args.Skip(3).ToArray();

            var instruments = instrumentArgs
                              .Select(i => this.instrumentFactory.CreateInstrument(i))
                              .ToArray();

            IPerformer performer = this.performerFactory.CreatePerformer(name, age);

            foreach (var instrument in instruments)
            {
                performer.AddInstrument(instrument);
            }

            this.stage.AddPerformer(performer);

            return(string.Format(RegisteredPerformer, performer.Name));
        }
Exemplo n.º 11
0
        public string SignUpPerformer(string[] args)
        {
            string name = args[0];
            int    age  = int.Parse(args[1]);

            IPerformer performer = performerFactory.CreatePerformer(name, age);

            IList <IInstrument> performerInstumets = new List <IInstrument>();

            if (args.Length > 2)
            {
                foreach (var typeInstrument in args.Skip(2).ToList())
                {
                    IInstrument instrument = instumentFactory.CreateInstrument(typeInstrument);
                    performer.AddInstrument(instrument);
                }
            }

            this.stage.AddPerformer(performer);

            return($"Registered performer {performer.Name}");
        }