示例#1
0
        static void Main(string[] args)
        {
            TrackStore tracks = TrackStore.GetTestTrackStore();

            tracks.RemoveArtist("Fred Bloggs");
            Console.WriteLine(tracks);
            Console.ReadKey();
        }
示例#2
0
        public static TrackStore GetTestTrackStore()
        {
            TrackStore result = new TrackStore();

            string[] artistNames = new string[] { "Rob Miles", "Fred Bloggs", "The Bloggs Singers", "Immy Brown" };
            string[] titleNames  = new string[] { "My Way", "Your Way", "His Way", "Her Way", "Milky Way" };

            Random rand = new Random(1);

            foreach (string artistName in artistNames)
            {
                foreach (string titleName in titleNames)
                {
                    MusicTrack newTrack = new MusicTrack
                    {
                        Artist = artistName,
                        Title  = titleName,
                        Length = rand.Next(20, 600)
                    };
                    result.Add(newTrack);
                }
            }
            return(result);
        }