Exemplo n.º 1
0
        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')"
            });
        }
Exemplo n.º 2
0
 public Task<Category> GetCategoryByIdAsync(Category category)
 {
     return Task.Run(() => GetCategoryById(category));
 }
Exemplo n.º 3
0
 public abstract Category GetCategoryById(Category category);
Exemplo n.º 4
0
 public Task<IEnumerable<Artist>> GetArtistsForCategoryAsync(Category category)
 {
     return Task.Run(() => GetArtistsForCategory(category));
 }
Exemplo n.º 5
0
 public abstract IEnumerable<Artist> GetArtistsForCategory(Category category);
Exemplo n.º 6
0
 public void SetUp()
 {
     category = new Category();
 }
Exemplo n.º 7
0
 public Category GetCategoryById(Category category)
 {
     return bl.GetCategoryById(category);
 }
Exemplo n.º 8
0
 public List<Artist> GetArtistsForCategory(Category category)
 {
     return bl.GetArtistsForCategory(category).ToList();
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 11
0
 public static bool IsEqualTo(this Category c1, Category c2)
 {
     return c1.Id == c2.Id
         && c1.Description == c2.Description
         && c1.Color == c2.Color;
 }
Exemplo n.º 12
0
 public CategoryViewModel(Category category)
 {
     this.Category = category;
     bl = BusinessLogicFactory.GetBusinessLogic();
 }
Exemplo n.º 13
0
 public override Category GetCategoryById(Category category)
 {
     return dalFactory.CreateCategoryDAO(db).GetById(category.Id);
 }
Exemplo n.º 14
0
 public override IEnumerable<Artist> GetArtistsForCategory(Category category)
 {
     return dalFactory.CreateArtistDAO(db).GetForCategory(category);
 }