コード例 #1
0
        public void IsNotNullWhenIsGetFromFile()
        {
            //Arrange
            var cut = new CinemaIdJSONFileSource();
            //Act
            var result = cut.GetJson();

            //Assert
            Assert.NotNull(result);
        }
コード例 #2
0
            public void IsGetProperIDWhenTakeDataFromFile(string location, int properId)
            {
                //Arrange
                var parsedJson = new CinemaIdJSONFileSource();
                var cut        = new CinemaIdDownloader(parsedJson.GetJson());

                //Act
                int result = cut.GetId(location);

                //Assert
                Assert.AreEqual(result, properId);
            }
コード例 #3
0
        public void DoesNotThrowAnyException(string location)
        {
            //Arrange
            var cut        = new FilmDataDownloaderWebSource();
            var parsedJson = new CinemaIdJSONFileSource();
            CinemaIdDownloader idDownloader = new CinemaIdDownloader(parsedJson.GetJson());
            //Act
            int id = idDownloader.GetId(location);

            //Assert
            Assert.DoesNotThrow(() => cut.Get(id)); //delegat??
        }
コード例 #4
0
        /// <summary>
        /// Method deserialize JSON and save cinemas locations to list.
        /// </summary>
        /// <returns>Return alphabetically sorted list</returns>
        public List <string> Execute()
        {
            CinemaIdJSONFileSource cinemaLocation        = new CinemaIdJSONFileSource();
            CinemaLocation         venues                = cinemaLocation.GetJson();
            List <string>          listOfCinemaLocations = new List <string>();

            foreach (var venue in venues.Venues)
            {
                foreach (var cinema in venue.Cinemas)
                {
                    listOfCinemaLocations.Add(cinema.Search);
                }
            }
            listOfCinemaLocations.Sort();

            return(listOfCinemaLocations);
        }
コード例 #5
0
        /// <summary>
        /// Method deserialize JSON with CinemaIdJSONFileSource class.
        /// </summary>
        /// <returns>Return string with cinema list splited by ", "</returns>
        public string Execute()
        {
            CinemaIdJSONFileSource cinemaLocation = new CinemaIdJSONFileSource();
            CinemaLocation         venues         = cinemaLocation.GetJson();
            StringBuilder          cinemaList     = new StringBuilder();

            foreach (var venue in venues.Venues)
            {
                foreach (var cinema in venue.Cinemas)
                {
                    cinemaList.Append(cinema.Search + ",");
                }
            }


            return(cinemaList.ToString());
        }