public void SetUp()
        {
            transaction = new TransactionScope();
            DALFactory factory = DALFactory.GetInstance();
            db = factory.CreateDatabase();
            dao = factory.CreateCategoryDAO(db);
            category = new Category {
                Id = 1,
                Description = "Musik",
                Color = "red"
            };

            runDbCommands(db, new List<string> {
                "SET FOREIGN_KEY_CHECKS=0",
                "DELETE FROM `category`",
                "INSERT INTO `category` VALUES (1, 'Musik', 'red')",
                "INSERT INTO `category` VALUES (2, 'Tanz', 'blue')"
            });
        }
Exemple #2
0
 public Task<Category> GetCategoryByIdAsync(Category category)
 {
     return Task.Run(() => GetCategoryById(category));
 }
Exemple #3
0
 public abstract Category GetCategoryById(Category category);
Exemple #4
0
 public Task<IEnumerable<Artist>> GetArtistsForCategoryAsync(Category category)
 {
     return Task.Run(() => GetArtistsForCategory(category));
 }
Exemple #5
0
 public abstract IEnumerable<Artist> GetArtistsForCategory(Category category);
Exemple #6
0
 public void SetUp()
 {
     category = new Category();
 }
Exemple #7
0
 public Category GetCategoryById(Category category)
 {
     return bl.GetCategoryById(category);
 }
Exemple #8
0
 public List<Artist> GetArtistsForCategory(Category category)
 {
     return bl.GetArtistsForCategory(category).ToList();
 }
Exemple #9
0
 public IEnumerable<Artist> GetForCategory(Category category)
 {
     var result = new List<Artist>();
     DbCommand cmd = createSelectForCategoryCommand(category);
     using (IDataReader reader = db.ExecuteReader(cmd)) {
         while (reader.Read()) {
             result.Add(createArtistFromReader(reader));
         }
     }
     return result;
 }
Exemple #10
0
 private DbCommand createSelectForCategoryCommand(Category category)
 {
     DbCommand cmd = db.CreateCommand(SQL_SELECT_FOR_CATEGORY);
     db.DefineParameter(cmd, "@CategoryId", DbType.Int32, category.Id);
     db.DefineParameter(cmd, "@Deleted", DbType.Boolean, false);
     return cmd;
 }
Exemple #11
0
 public static bool IsEqualTo(this Category c1, Category c2)
 {
     return c1.Id == c2.Id
         && c1.Description == c2.Description
         && c1.Color == c2.Color;
 }
 public CategoryViewModel(Category category)
 {
     this.Category = category;
     bl = BusinessLogicFactory.GetBusinessLogic();
 }
Exemple #13
0
 public override Category GetCategoryById(Category category)
 {
     return dalFactory.CreateCategoryDAO(db).GetById(category.Id);
 }
Exemple #14
0
 public override IEnumerable<Artist> GetArtistsForCategory(Category category)
 {
     return dalFactory.CreateArtistDAO(db).GetForCategory(category);
 }