//[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); }
//[Test] //[Category("CategoryDataTest")] public void TestMethod_AddCategory() { var newCategory = new Category { CategoryName = "UnityTestCat_CategoryTest" }; var response = _catProvider.AddCategory(newCategory); Assert.AreEqual(response, 1); var searchCount = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCat_CategoryTest").ToList().Count; Assert.IsTrue(searchCount > 0); }
public void Benchmark() { var newCategory = new Category { CategoryName = "UnitTestCategory_" + DateTime.Now.Ticks }; if (!_catToAdd.Contains(newCategory.CategoryName)) { var response = _catProvider.AddCategory(newCategory); _opCounter.Increment(); _catToAdd.Add(newCategory.CategoryName); } }
//[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 async Task <ActionResult <bool> > AddCategory(int postId, string tag) { return(await _categoryProvider.AddCategory(postId, tag)); }