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);
        }
        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);
                    }
                }
            }
        }
        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);
        }
Пример #4
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();
     }
 }