Example #1
0
        public void Parse_isEmptyString_Test()
        {
            var str    = "";
            var prices = PriceFormer.Prices(str);

            Assert.IsNull(prices);
        }
Example #2
0
        public void Parse_isNotNumbers_Test()
        {
            var str    = "feffefef";
            var prices = PriceFormer.Prices(str);

            Assert.IsNull(prices);
        }
Example #3
0
        public void Florence_Parse_isNotFactNum_Test()
        {
            var str    = "23-12";
            var prices = PriceFormer.Prices(str);

            Assert.IsNull(prices);
        }
Example #4
0
        public void Florence_Parse_Num_dash_Num_Test2()
        {
            var str          = "65-85";
            var pricesActual = PriceFormer.Prices(str);
            var pricesExpect = new List <Price>()
            {
                new Price(1, 65),
                new Price(2, 70),
                new Price(3, 75),
                new Price(4, 85)
            };

            for (int i = 0; i < pricesActual.Count; i++)
            {
                Trace.WriteLine($"actual: {pricesActual[i].Type} - {pricesActual[i].Money} UAH");
                Trace.WriteLine($"expect: {pricesExpect[i].Type} - {pricesExpect[i].Money} UAH");
                Trace.WriteLine("-----------");
                Assert.AreEqual(pricesActual[i].Money, pricesExpect[i].Money);
            }
        }
Example #5
0
        public void Boomer_Parse_Num_Num_Num_Test()
        {
            var str    = "45 55 65";
            var prices = PriceFormer.Prices(str);

            var pricesActual = PriceFormer.Prices(str);
            var pricesExpect = new List <Price>()
            {
                new Price(1, 45),
                new Price(2, 55),
                new Price(3, 65),
            };

            for (int i = 0; i < pricesActual.Count; i++)
            {
                Trace.WriteLine($"actual: {pricesActual[i].Type} - {pricesActual[i].Money} UAH");
                Trace.WriteLine($"expect: {pricesExpect[i].Type} - {pricesExpect[i].Money} UAH");
                Trace.WriteLine("-----------");
                Assert.AreEqual(pricesActual[i].Money, pricesExpect[i].Money);
            }
        }
Example #6
0
        public ActionResult Hall(long cinemaId, long hallId, long seanceId, string dateSeance, long timeSeanceId, long movieId)
        {
            var seanceData   = seanceService.GetDataFromAPISeanceByMovieTheaterAndDate(cinemaId, movieId, dateSeance);
            var movieModel   = mapperMovieModel.Map <Movie, MovieBookModel>(movieService.GetFromAPI(movieId));
            var theaterModel = mapperTheaterModel.Map <Theater, TheaterBookModel>(seanceData.Theaters[0]);
            var date         = DateTime.ParseExact(dateSeance, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture);
            var seanceModel  = mapperSeanceModel.Map <Seance, SeanceModel>(seanceData.Seances.Find(s => s.Id == seanceId));
            var timeSeance   = seanceModel.Times.Find(t => t.Id == timeSeanceId);

            var hallName    = seanceData.Halls.Find(h => h.Id == seanceModel.HallId).Name;
            var technology  = (timeSeance.Is3D == true) ? "3D" : "2D";
            var pricesModel = mapperPriceModel.Map <List <Price>, List <PriceModel> >(PriceFormer.Prices(timeSeance.Prices));

            var bookData = new BookDataModel(timeSeanceId, hallName, date, movieModel, timeSeance, theaterModel, technology, pricesModel);

            //ViewBag.LastElId = bookService.GetLastElId();

            return(View(bookData));
        }