public void RoadsManager_GetFindRouteDetailsModel_NegativeTestsForArgumentNullException(string hash, string language)
        {
            //arrange
            var routesRepository = new RoutesRepository(_datacontext);
            var manager = new RoadsManager(routesRepository);

            //act
            Common.Models.DataContract.RouteDetailsData routeDetailsData = manager.GetRouteDetailsByHash(hash, language);
        }
示例#2
0
        public void RoadsManager_GetHashForRoute(string trek, string hash)
        {
            //arrange
            var repository = new RoutesRepository(_datacontext);

            var manager = new RoadsManager(repository);

            //act
            var result = manager.GetHashForRoute(trek);

            //asserts
            Assert.AreEqual(result, hash);
        }
示例#3
0
        public void RoadsManager_BuildRoutes_CheckNumbersOfResponse(int fromId, int toId, int count)
        {
            //arrange
            var repository = new RoutesRepository(_datacontext);

            var manager = new RoadsManager(repository);

            //act
            var result = manager.BuildRoutes(fromId, toId);

            //assert
            Assert.AreEqual(result.Count, count);
        }
        public void RoadsManager_GetFindRouteDetailsModel_NegativeTests(string hash, string language)
        {
            //arrange
            var routesRepository = new RoutesRepository(_datacontext);
            var manager = new RoadsManager(routesRepository);

            //act
            Common.Models.DataContract.RouteDetailsData routeDetailsData = manager.GetRouteDetailsByHash(hash, language);

            //assert
            Assert.IsNotNull(routeDetailsData);
            Assert.IsNotNull(routeDetailsData.RouteDetailsItems);
            Assert.AreEqual(routeDetailsData.RouteDetailsItems.Count, 0);
        }
示例#5
0
        public void RoadsManager_GetRouteEstimation_SendStringRoad_CheckCount(string road, int pointsCout)
        {
            //arrange
            var repository = new RoutesRepository(_datacontext);

            var manager = new RoadsManager(repository);

            //act
            var result = manager.GetRouteEstimation(road);

            //asserts
            Assert.AreEqual(result.CityPointsIds.Count(), pointsCout);
        }
        public void RoadsManager_GetFindRouteDetailsModel_PositiveTests(string hash, string language, string[] expected)
        {
            var routesRepository = new RoutesRepository(_datacontext);
            var manager = new RoadsManager(routesRepository);

            Common.Models.DataContract.RouteDetailsData routeDetailsData = manager.GetRouteDetailsByHash(hash, language);

            Assert.IsNotNull(routeDetailsData);
            Assert.IsNotNull(routeDetailsData.RouteDetailsItems);
            Assert.AreEqual(routeDetailsData.RouteDetailsItems.Count, expected.Length-1);
            for (int index = 0; index < routeDetailsData.RouteDetailsItems.Count; index++)
            {
                var routeDetailsItem = routeDetailsData.RouteDetailsItems[index];

                Assert.IsNotNull(routeDetailsItem);
                foreach (var routeDetailsFeedback in routeDetailsItem)
                {
                    Assert.IsNotNull(routeDetailsFeedback);
                    Assert.AreEqual(routeDetailsFeedback.OriginCityName, expected[index]);
                    Assert.AreEqual(routeDetailsFeedback.DestinationCityName,
                        index == (expected.Length - 1) ? expected[expected.Length - 1] : expected[index + 1]);
                    Assert.IsNotNull(routeDetailsFeedback.DestinationCityId);
                    Assert.IsNotNull(routeDetailsFeedback.OriginCityId);
                    Assert.IsNotNull(routeDetailsFeedback.SubmitTime);
                    Assert.IsNotNull(routeDetailsFeedback.UserName);
                    Assert.IsNotNull(routeDetailsFeedback.FeedbackId);
                    Assert.IsNotNull(routeDetailsFeedback.FeedbackValues);
                    foreach (var feedbackValueData in routeDetailsFeedback.FeedbackValues)
                    {
                        Assert.IsNotNull(feedbackValueData);
                        Assert.IsNotNull(feedbackValueData.FeedbackId);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem);
                        Assert.IsNotNull(feedbackValueData.FeedbackItemId);
                        Assert.IsNotNull(feedbackValueData.FeedbackValueId);
                        Assert.IsNotNull(feedbackValueData.Value);
                        Assert.IsNotNullOrEmpty(feedbackValueData.FeedbackItem.DescriptionTranslationKey);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem.FeedbackItemId);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem.FeedbackModelId);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem.IsNumeric);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem.Mandatory);
                        Assert.IsNotNullOrEmpty(feedbackValueData.FeedbackItem.NameTranslationKey);
                        Assert.IsNotNull(feedbackValueData.FeedbackItem.SortNumber);
                    }
                }
            }
        }
示例#7
0
 /// <summary>
 /// Gets the feedback controls list for new feedback.
 /// </summary>
 /// <returns>Return RouteDetailsData objeect.</returns>
 public RouteDetailsData GetRouteDetailsByHash(string hash, string language)
 {
     try
     {
         var manager = new RoadsManager();
         return manager.GetRouteDetailsByHash(hash, language);
     }
     catch (Exception ex)
     {
         return new RouteDetailsData();
     }
 }
示例#8
0
        /// <summary>
        /// Gets the roads for.
        /// </summary>
        /// <param name="startedCityId">The started city identifier.</param>
        /// <param name="destinationCityId">The destination city identifier.</param>
        /// <param name="page">The page.</param>
        /// <param name="languageName">Name of the language.</param>
        /// <returns>
        /// The list of <see cref="RoutesSearchResultData" />
        /// </returns>
		public async Task<RoutesSearchResultData> GetRoadsFor( int startedCityId, int destinationCityId, int page, string languageName, bool isRouteValidation )
        {
            try
            {
                using (var manager = new RoadsManager())
                {
					return await manager.GetRoutesSearchResult( startedCityId, destinationCityId, page, languageName, isRouteValidation );
                }
            }
            catch (Exception ex)
            {
                //TODO ADD tracking
                return new RoutesSearchResultData();
            }
        }