Exemple #1
0
        public void TestMethod_AddCollection_Failure()
        {
            // Arrange
            var newCollection = new Collection {
                CollectionCategoryId = -1, WorkoutTitle = "UnitTest_CollectionTest", WorkoutNote = ""
            };

            //Act
            ActualValueDelegate <object> testDelegate = () => _colProvider.AddCollection(newCollection);

            //Assert
            Assert.That(testDelegate, Throws.TypeOf <System.Data.Entity.Infrastructure.DbUpdateException>());
        }
Exemple #2
0
        //[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);
        }