コード例 #1
0
        public void TestEqual()
        {
            WallBeam wallBeam        = new WallBeam(POINT);
            WallBeam anotherWallBeam = new WallBeam(POINT);

            Assert.AreEqual(wallBeam, anotherWallBeam);
        }
コード例 #2
0
        public PriceAndCost GetPriceAndCostWallBeam()
        {
            WallBeam     wallBeam     = wallBeamHandler.GetFirst();
            PriceAndCost priceAndCost = _context.PricesAndCosts
                                        .Where(p => p.PriceAndCostId == 2)
                                        .FirstOrDefault();

            return(priceAndCost);
        }
コード例 #3
0
        public void AddWallBeam(Grid grid, WallBeam wallBeam)
        {
            var co = (from c in _context.Grids
                      where c.GridId == grid.GridId
                      select c).FirstOrDefault();

            co.WallBeams.Add(wallBeam);
            _context.SaveChanges();
        }
コード例 #4
0
ファイル: GridTest.cs プロジェクト: invict1/Graphic-Master
        public void TestGetWallBeam()
        {
            Point    point    = new Point(0, 1);
            WallBeam wallBeam = new WallBeam(point);

            grid.WallBeams.Add(wallBeam);
            WallBeam expectedResult = grid.GetWallBeam(point);

            Assert.AreEqual(wallBeam, expectedResult);
        }
コード例 #5
0
ファイル: GridTest.cs プロジェクト: invict1/Graphic-Master
        public void TestValidWallBeamFalse()
        {
            Point    point    = new Point(0, 1);
            WallBeam wallBeam = new WallBeam(point);

            grid.WallBeams.Add(wallBeam);
            WallBeam anotherWallBeam = new WallBeam(point);
            bool     expectedResult  = false;
            bool     result          = grid.FreePosition(point);

            Assert.AreEqual(result, expectedResult);
        }
コード例 #6
0
        public void Remove(Grid grid, WallBeam wallBeam)
        {
            WallBeam wallBeamToDelete = null;

            wallBeamToDelete = _context.WallBeams
                               .Where(w =>
                                      (w.Grid.GridId == grid.GridId && w.WallBeamId == wallBeam.WallBeamId))
                               .FirstOrDefault();

            _context.WallBeams.Remove(wallBeamToDelete);
            _context.SaveChanges();
        }
コード例 #7
0
        public bool Exist(Grid grid, Point ubicationPoint)
        {
            WallBeam wallBeamToFind = null;

            wallBeamToFind = _context.WallBeams
                             .Where(w => (w.Grid.GridId == grid.GridId &&
                                          w.UbicationPoint.X == ubicationPoint.X) &&
                                    w.UbicationPoint.Y == ubicationPoint.Y)
                             .FirstOrDefault();

            return(!(wallBeamToFind == null));
        }
コード例 #8
0
ファイル: GridTest.cs プロジェクト: invict1/Graphic-Master
        public void TestRemoveWallBeam()
        {
            Point    point           = new Point(0, 1);
            WallBeam wallBeam        = new WallBeam(point);
            Point    anotherPoint    = new Point(0, 5);
            WallBeam anotherWallBeam = new WallBeam(anotherPoint);

            grid.WallBeams.Add(anotherWallBeam);
            grid.WallBeams.Add(wallBeam);
            grid.WallBeams.Remove(wallBeam);
            bool resultExpected = true;
            bool result         = grid.WallBeams.Count.Equals(1);

            Assert.AreEqual(resultExpected, result);
        }
コード例 #9
0
 public void Add(Grid grid, WallBeam wallBeam, PriceAndCost priceAndCost)
 {
     try
     {
         PriceAndCost priceCost = _context.PricesAndCosts
                                  .Where(w => w.PriceAndCostId == priceAndCost.PriceAndCostId)
                                  .FirstOrDefault();
         wallBeam.PriceAndCost = priceCost;
         _context.Grids.Attach(grid);
         wallBeam.Grid = grid;
         _context.WallBeams.Add(wallBeam);
         _context.SaveChanges();
     }
     catch (Exception e)
     {
     }
 }
コード例 #10
0
        public void TestCreateWallBeam()
        {
            WallBeam wallBeam = new WallBeam(POINT);

            Assert.IsNotNull(wallBeam);
        }