Classifier.CuisinesClassifier.RestaurantsClassifier.SaveResults C# (CSharp) Method

SaveResults() public method

public SaveResults ( ) : void
return void
        public void SaveResults()
        {
            foreach (RestaurantBasicData rest in allClassified)
            {
                try
                {
                    DateTime date = DateTime.UtcNow;
                    rest.Source = "CuisineClassifier_" + date.Year.ToString() + "." + date.Month.ToString() + "." + date.Day.ToString();
                    rest.UpdatedBy = "CuisineClassifier_" + date.Year.ToString() + "." + date.Month.ToString() + "." + date.Day.ToString();
                    RestaurantUpdate.Update(rest);
                }
                catch (Exception e)
                {
                    log.ErrorFormat("[SaveResults] Exception={0}.", e.Message);
                }
            }
        }

Usage Example

        public void ClassifyTest_ShouldSaveResults_UpdateRestaurantsInDB()
        {
            string classifierName = "CuisinesSupervised1";
            RealTenTestRestaurants restaurantsSource = new RealTenTestRestaurants();

            RestaurantsClassifier restClassifier = new RestaurantsClassifier(restaurantsSource, classifierName);

            var classified = restClassifier.Classify();
            restClassifier.SaveResults();

            //Assert
            Assert.IsNotNull(classified);
        }