public Category Add(Category category)
 {
     return AddOrUpdate<Category>("mm_Categories_Create", new {
         UserID = _userId,
         Account_AccountID = category.Account_AccountID,
         Name = category.Name,
         Type = category.Type
     });
 }
        public void Data_Create_Category()
        {
            var repository = new CategoryRepository(_dataConnectionString, 1);

            var category = new MABMoney.Domain.Category {
                Account_AccountID = 1,
                Name = "ADDED",
                Type = CategoryType.Income
            };

            var result = repository.Add(category);

            Assert.IsTrue(result.CategoryID == 11);
            Assert.IsTrue(result.Name == "ADDED");
            Assert.IsTrue(result.Type == CategoryType.Income);
            Assert.IsTrue(result.Account_AccountID == 1);
            Assert.IsTrue(result.AccountName == "Current");
            Assert.IsTrue(result.CreatedBy == 1);
            Assert.IsTrue(result.CreatedDate.Date == DateTime.Now.Date);
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
        }
        public void Data_Create_Existing_Deleted_Category()
        {
            var repository = new CategoryRepository(_dataConnectionString, 1);

            var category = new MABMoney.Domain.Category {
                Account_AccountID = 1,
                Name = "Deleted",
                Type = CategoryType.Expense
            };

            var result = repository.Add(category);

            Assert.IsTrue(result.CategoryID == 5);
            Assert.IsTrue(result.Name == "Deleted");
            Assert.IsTrue(result.Type == CategoryType.Expense);
            Assert.IsTrue(result.Account_AccountID == 1);
            Assert.IsTrue(result.AccountName == "Current");
            Assert.IsTrue(result.LastModifiedBy == 1);
            Assert.IsTrue(result.LastModifiedDate.Date == DateTime.Now.Date);
            Assert.IsTrue(result.Deleted == false);
            Assert.IsTrue(result.DeletedDate == null);
            Assert.IsTrue(result.DeletedBy == null);
        }