Example #1
0
        public void TestEqual()
        {
            WallBeam wallBeam        = new WallBeam(POINT);
            WallBeam anotherWallBeam = new WallBeam(POINT);

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

            return(priceAndCost);
        }
Example #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();
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #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();
        }
Example #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));
        }
Example #8
0
        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);
        }
Example #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)
     {
     }
 }
Example #10
0
        public void TestCreateWallBeam()
        {
            WallBeam wallBeam = new WallBeam(POINT);

            Assert.IsNotNull(wallBeam);
        }