コード例 #1
0
        public void LoadTest()
        {
            PerformancePieceList PerformancePieces = new PerformancePieceList();

            PerformancePieces.Load();
            Assert.AreEqual(6, PerformancePieces.Count);
        }
        // GET: api/PerformancePiece
        public IEnumerable <PerformancePiece> Get()
        {
            PerformancePieceList performancePieces = new PerformancePieceList();

            performancePieces.Load();
            return(performancePieces);
        }
コード例 #3
0
        public void LoadById()
        {
            //Load up Guids
            PieceList pieces = new PieceList();
            Piece     piece  = new Piece();

            pieces.Load();
            piece = pieces.FirstOrDefault(p => p.Name == "Rock Music");

            GroupList groups = new GroupList();
            Group     group  = new Group();

            groups.Load();
            group = groups.FirstOrDefault(c => c.Name == "Jazz Ensemble");

            PerformanceList performances = new PerformanceList();
            Performance     performance  = new Performance();

            performances.Load();
            performance = performances.FirstOrDefault(c => c.Name == "Dream Concert");

            DirectorList directors = new DirectorList();
            Director     director  = new Director();

            directors.Load();
            director = directors.FirstOrDefault(c => c.FirstName == "Eric");

            PerformancePiece     performancePiece  = new PerformancePiece();
            PerformancePieceList performancePieces = new PerformancePieceList();

            performancePieces.Load();
            performancePiece         = performancePieces.FirstOrDefault(p => p.GroupId == group.Id && p.PieceId == piece.Id && p.PerformanceId == performance.Id);
            performancePiece.Notes   = "BL Test";
            performancePiece.MP3Path = "BL Test";

            PerformancePiece newperformancePiece = new PerformancePiece {
                Id = performancePiece.Id
            };

            newperformancePiece.LoadById();

            Assert.AreEqual(performancePiece.DirectorId, newperformancePiece.DirectorId);
        }
コード例 #4
0
        public void UpdateTest()
        {
            //Load up Guids
            PieceList pieces = new PieceList();
            Piece     piece  = new Piece();

            pieces.Load();
            piece = pieces.FirstOrDefault(p => p.Name == "Rock Music");

            GroupList groups = new GroupList();
            Group     group  = new Group();

            groups.Load();
            group = groups.FirstOrDefault(c => c.Name == "Jazz Ensemble");

            PerformanceList performances = new PerformanceList();
            Performance     performance  = new Performance();

            performances.Load();
            performance = performances.FirstOrDefault(c => c.Name == "Dream Concert");

            DirectorList directors = new DirectorList();
            Director     director  = new Director();

            directors.Load();
            director = directors.FirstOrDefault(c => c.FirstName == "Eric");

            PerformancePiece     performancePiece  = new PerformancePiece();
            PerformancePieceList performancePieces = new PerformancePieceList();

            performancePieces.Load();
            performancePiece         = performancePieces.FirstOrDefault(p => p.GroupId == group.Id && p.PieceId == piece.Id && p.PerformanceId == performance.Id);
            performancePiece.Notes   = "BL Test";
            performancePiece.MP3Path = "BL Test";

            performancePiece.DirectorId = director.Id;
            int results = performancePiece.Update();

            Assert.IsTrue(results == 1);
        }