Beispiel #1
0
        public static void Main(string[] args)
        {
            var originalObject        = new MovieCharacteristics();
            var cLientConfigurator    = new CLientConfigurator();
            var rottenTomatoesService = new RottenTomatoesService();
            var imdbService           = new ImdbService();

            originalObject.GetData();
            Console.WriteLine("originalObject: " + originalObject);
            Console.WriteLine("*******************************************************");

            var clonedObject = originalObject.Clone();

            cLientConfigurator.ConfigureImdbData(clonedObject);
            Console.WriteLine("clonedObject.Ratings.Remove('IMDB: 9')=> change inmutable rating field which is deep cloned");
            cLientConfigurator.ConfigureGeneralGenre(clonedObject);
            Console.WriteLine("clonedObject.Genre.Add('SuperHero') = > change in genre which is shallow cloned");
            Console.WriteLine("clonedObject: " + clonedObject);
            Console.WriteLine(" clonedObject shows all above changes");
            Console.WriteLine("*******************************************************");

            Console.WriteLine("originalObject: " + originalObject);
            Console.WriteLine("Original Object shows changes in only genre as");
            Console.WriteLine("it was shallow cloned. Changes in rating will not occur in original onject as it is deep cloned.");
            Console.WriteLine("*******************************************************");

            imdbService.SendDataToImdb(clonedObject);
            cLientConfigurator.ConfigureRottenTomatoesData(originalObject);
            rottenTomatoesService.SendDataToRottenTomatoes(originalObject);
        }
        public static void Main()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            IBlurayDotComService   brService   = new BlurayDotComService();
            IBoxOfficeMojoService  bomService  = new BoxOfficeMojoService();
            IDvdEmpireService      deService   = new DvdEmpireService();
            IImdbService           imdbService = new ImdbService();
            IRottenTomatoesService rtService   = new RottenTomatoesService();

            Task.Run(async() =>
            {
                try
                {
                    //var model = await brService.SearchTitleResultsAsync(MadMaxSearchTitle);
                    //var model = await bomService.SearchTitleResultsAsync(MadMaxSearchTitle);
                    //var model = await deService.SearchTitleResultsAsync(MadMaxSearchTitle);
                    //var model = await imdbService.SearchTitleResultsAsync(MadMaxSearchTitle);
                    //var model = await rtService.SearchTitleResultsAsync(MadMaxSearchTitle);

                    //var m1 = await brService.GetMovieDataAsync(MadMaxFuryRoadBrId);
                    //var m2 = await bomService.GetMovieDataAsync(MadMaxFuryRoadBomId);
                    //var m3 = await deService.GetMovieDataAsync(MadMaxFuryRoadDeId);
                    var m4 = await imdbService.GetMovieDataAsync(MadMaxFuryRoadImdbId);
                    //var m5 = await rtService.GetMovieDataAsync(MadMaxFuryRoadRtId);
                    //Console.WriteLine(m1);
                    //Console.WriteLine(m2);
                    //Console.WriteLine(m3);
                    //Console.WriteLine(m4);
                    //Console.WriteLine(m5);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                }
            })
            .GetAwaiter()
            .GetResult();

            stopwatch.Stop();
            Console.WriteLine("Time elapsed: {0}", stopwatch.Elapsed);
        }