//[Test] //[Category("ActiveDataTest")] public void Test_AddActive_Success() { var newCategory = new Category { CategoryName = "UnityTestCat_ActiveTest" }; var response = _catProvider.AddCategory(newCategory); Assert.AreEqual(response, 1); var searchCat = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCat_ActiveTest").FirstOrDefault(); Assert.IsNotNull(searchCat); var newCollection = new Collection { CollectionCategoryId = searchCat.CategoryId, WorkoutTitle = "UnitTest_ActiveTest", WorkoutNote = "" }; var colResponse = _colProvider.AddCollection(newCollection); Assert.AreEqual(colResponse, 1); var searchCol = _colProvider.GetCollections().Where(w => w.WorkoutTitle == "UnitTest_ActiveTest").FirstOrDefault(); Assert.IsNotNull(searchCol); var newActive = new Active { ActiveWorkoutId = searchCol.WorkoutId, Comment = "UnitTest_Comment_ActiveTest", Status = false, StartDate = DateTime.Now, StartTime = DateTime.Now.TimeOfDay, EndDate = null, EndTime = null }; var actResponse = _actProvider.AddActiveRecord(newActive); Assert.IsNotNull(actResponse); }
public ActionResult ShowCategories() { IEnumerable <Category> categories = _categoryProvider.GetCategories(); IEnumerable <ShortCategoryViewModel> model = ParseCategoryViewModels(categories); if (Request.IsAjaxRequest()) { return(PartialView("_ShowCategories", model)); } else { return(View(model)); } }
private EditRecipeViewModel ParseEditRecipeViewModel(Recipe recipe, RecipeDetails recipeDetails) { EditRecipeViewModel returnedModel = new EditRecipeViewModel(); IEnumerable <Category> categories = _categoryProvider.GetCategories(); if (recipe != null) { returnedModel.RecipeId = recipe.RecipeId; returnedModel.Name = recipe.Name; returnedModel.ImageUrl = recipe.ImageUrl; returnedModel.CategoryId = recipe.CategoryId; returnedModel.Categories = new SelectList(categories, "CategoryId", "Name", returnedModel.CategoryId); } else { returnedModel.Categories = new SelectList(categories, "CategoryId", "Name"); } if (recipeDetails != null) { returnedModel.CookingTime = recipeDetails.CookingTime; returnedModel.CookingTemperature = recipeDetails.CookingTemperature; returnedModel.Description = recipeDetails.Description; } return(returnedModel); }
public void Cleanup() { foreach (string cat in _catToAdd) { var category = _catProvider.GetCategories().Where(w => w.CategoryName == cat).FirstOrDefault(); var result = _catProvider.DeleteCategory(category); } }
public IList <Categories> GetCategories() { if (m_category != null) { return(m_category); } return(m_category = m_provider.GetCategories()); }
//[Test] //[Category("CollectionDataTest")] public void TestMethod_AddCollection_Success() { var newCategory = new Category { CategoryName = "UnityTestCat_CollectionTest" }; var response = _catProvider.AddCategory(newCategory); Assert.AreEqual(response, 1); var searchCat = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCat_CollectionTest").FirstOrDefault(); Assert.IsNotNull(searchCat); var newCollection = new Collection { CollectionCategoryId = searchCat.CategoryId, WorkoutTitle = "UnitTest_CollectionTest", WorkoutNote = "" }; var colResponse = _colProvider.AddCollection(newCollection); Assert.AreEqual(colResponse, 1); }
public CategoryQuestionGenerator(IQuestionProvider provider, ICategoryProvider categoryProvider, int maxAnsw, int rounds) { this.provider = provider; state = QuestionGeneratorState.Uninitialized; numberOfMaxAnswers = maxAnsw; numberOfCategories = categoryProvider.GetCategories(); numberOfRounds = rounds; answersBuckets = new List <ILivingLetterData> [3]; this.categoryProvider = categoryProvider; for (int i = 0; i < 3; i++) { answersBuckets[i] = new List <ILivingLetterData>(); } ClearCache(); FillBuckets(); }
public CategoryMetaProvider(ICategoryProvider categoryProvider) { Categories = categoryProvider.GetCategories().ToDictionary( c => c.Name, c => c); }
//[Test] //[Category("CategoryDataTest")] public void TestMethod_GetCategories() { var categories = _catProvider.GetCategories(); Assert.IsNotNull(categories); }
public QuestionService(ICategoryProvider categoryProvider, int questionsPerCategory) { _categories = categoryProvider?.GetCategories() ?? throw new ArgumentNullException(); _questionsPerCategory = questionsPerCategory >= 0 ? questionsPerCategory : throw new ArgumentException(); }