public void Copy_Schedule()
        {
            // Arange
            int scheduleId = 1;
            string scheduleName = "ScheduleName1";

            int pierId = 1;
            string pierName = "PierName1";
            Pier pier = new Pier { Id = pierId, Name = pierName };

            int routeId = 1;
            string routeCode = "RouteCode1";
            string routeName = "RouteName1";
            Route route = new Route { Id = routeId, Code = routeCode, Name = routeName };

            TimeSpan time = new TimeSpan(0, 10, 0);

            Schedule oldSchedule = new Schedule { Id = scheduleId, Name = scheduleName, Pier = pier, Route = route, Time = time };

            // Act
            Schedule newSchedule = oldSchedule.Copy();

            // Assert
            Assert.AreNotSame(newSchedule, oldSchedule); // Not the same object

            // Check properties
            Assert.AreEqual(newSchedule.Id, scheduleId);
            Assert.AreEqual(newSchedule.Name, scheduleName);
            Assert.AreEqual(newSchedule.Route, route);
            Assert.AreEqual(newSchedule.Pier, pier);
            Assert.AreEqual(newSchedule.Time, time);

        }
Exemplo n.º 2
0
        /// <summary>
        /// 配置盖梁
        /// </summary>
        /// <param name="curCB">盖梁类</param>
        /// <param name="curBeam">当前主梁</param>
        /// <param name="curPier">当前桥墩</param>
        /// <param name="w0">当前桥宽</param>
        private void GetCapBeam(out CapBeam curCB, SupStructure curBeam, Pier curPier, double w0)
        {
            double l = w0;
            double dl, dv;

            if (curPier.GetType() == typeof(SolidCirclePier))
            {
                dl = 1.6;
                dv = 1.7;
            }
            else
            {
                dl = curPier.DimLong + 0.4;
                if (curBeam.curBeamType == Globals.BeamType.T25)
                {
                    dv = 2.0;
                }
                else
                {
                    dv = 2.5;
                }
            }

            curCB = new CapBeam(l, dl, dv, 180, 0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 配置桥墩
        /// </summary>
        /// <param name="curPier">桥墩类</param>
        /// <param name="curBt">当前主梁</param>
        /// <param name="hh">设计高差</param>
        private void GetPier(out Pier curPier, SupStructure curBt, double hh)
        {
            double h0 = hh - 2.0;

            curPier = null;

            if (h0 < 0)
            {
                curPier = null;
            }
            else if (h0 <= 10)
            {
                curPier = new SolidCirclePier(1.0, h0, 180, 0);
            }
            else if (h0 <= 25)
            {
                curPier = new SolidCirclePier(1.0, h0, 180, 0);
            }
            else if (h0 <= 40)
            {
                curPier = new SolidCirclePier(1.0, h0, 180, 0);
            }
            else
            {
                curPier = new SolidCirclePier(1.0, h0, 180, 0);
            }
        }
        public void Delete_Schedule_By_ScheduleId()
        {
            int scheduleId = 1;
            Pier pier = new Pier { Name = "Pier Test" };
            Route route = new Route { Name = "Route Test", TimeTable = new TimeTable { Name = "TimeTable" } };

            // Add to database
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                ScheduleRepository scheduleRepository = new ScheduleRepository(ctx);
                scheduleRepository.Add(new Schedule { Id = scheduleId, Pier = pier, Route = route, Time = new TimeSpan(1, 0, 0) });
                scheduleRepository.SaveChanges();
            }

            // Find and delete it
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                List<Schedule> schedules = ctx.Schedules.Where(schedule => schedule.Id == scheduleId).ToList();
                Assert.AreEqual(1, schedules.Count());
            }

            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                ScheduleRepository scheduleRepository = new ScheduleRepository(ctx);
                scheduleRepository.Delete(scheduleId);
                scheduleRepository.SaveChanges();
            }

            // Check that nothing is there
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                List<Schedule> schedules = ctx.Schedules.Where(schedule => schedule.Pier.Id == pier.Id && schedule.Route.Id == route.Id).ToList();
                Assert.AreEqual(0, schedules.Count());
            }
        }
Exemplo n.º 5
0
    void Start()
    {
        inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();

        pierGO = GameObject.FindGameObjectWithTag("Pier");
        pier   = pierGO.GetComponent <Pier>();
    }
Exemplo n.º 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pier pier = db.Piers.Find(id);

            db.Piers.Remove(pier);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetPier(this Panel panel, Pier pier)
        {
            Panel clone = (Panel)panel.GetShallowClone();

            clone.CustomData["EtabsPier"] = pier;

            return(clone);
        }
Exemplo n.º 8
0
 override public void Visit(Pier visitee)
 {
     _fieldRepresentation = 'K';
     if (visitee.content != null)
     {
         visitee.content.Accept(this);
     }
 }
 public ActionResult Edit(Pier pier)
 {
     if (ModelState.IsValid)
     {
         pierRepository.Update(pier);
         pierRepository.SaveChanges();
         return RedirectToAction("Index");
     }
     return View("Edit", pier);
 }
Exemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "Id,PierName,Latitude,Longitude")] Pier pier)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pier).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pier));
 }
 public ActionResult Create(Pier pier)
 {
     if (ModelState.IsValid)
     {
         pierRepository.Add(pier);
         pierRepository.SaveChanges();
         return RedirectToAction("Index");
     }
     return View("Create", pier);
 }
Exemplo n.º 12
0
        public ActionResult Create([Bind(Include = "Id,PierName,Latitude,Longitude")] Pier pier)
        {
            if (ModelState.IsValid)
            {
                db.Piers.Add(pier);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pier));
        }
Exemplo n.º 13
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pier pier = db.Piers.Find(id);

            if (pier == null)
            {
                return(HttpNotFound());
            }
            return(View(pier));
        }
Exemplo n.º 14
0
        /***************************************************/
        /**** Update Panel                              ****/
        /***************************************************/

        private bool UpdateObjects(IEnumerable <Panel> bhPanels)
        {
            //Make sure Diaphragms are pushed
            List <Diaphragm> diaphragms = bhPanels.Select(x => x.Diaphragm()).Where(x => x != null).ToList();

            this.FullCRUD(diaphragms, PushType.FullPush);

            bool success = true;

            m_model.SelectObj.ClearSelection();

            foreach (Panel bhPanel in bhPanels)
            {
                string name         = GetAdapterId <string>(bhPanel);
                string propertyName = GetAdapterId <string>(bhPanel.Property);

                Engine.Base.Compute.RecordWarning("The Etabs API does not allow for updating of the geometry of panels. This includes the external edges as well as the openings. To update the panel geometry, delete the existing panel you want to update and create a new one.");

                m_model.AreaObj.SetProperty(name, propertyName);

                //Set local orientations:
                Basis orientation = bhPanel.LocalOrientation();
                m_model.AreaObj.SetLocalAxes(name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y));

                Pier      pier      = bhPanel.Pier();
                Spandrel  spandrel  = bhPanel.Spandrel();
                Diaphragm diaphragm = bhPanel.Diaphragm();

                if (pier != null)
                {
                    int ret = m_model.PierLabel.SetPier(pier.Name);
                    ret = m_model.AreaObj.SetPier(name, pier.Name);
                }
                if (spandrel != null)
                {
                    int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false);
                    ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name);
                }
                if (diaphragm != null)
                {
                    m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
                }
            }

            //Force refresh to make sure panel local orientation are set correctly
            ForceRefresh();

            return(success);
        }
        public void Create_Returns_To_Index_When_Valid()
        {
            // Arange
            Pier validPierToAdd = new Pier();
            string expectedAction = "Index";

            PierController pierController = unityContainer.Resolve<PierController>();

            // Act
            var result = pierController.Create(validPierToAdd) as RedirectToRouteResult;

            // Asert
            Assert.IsNotNull(result, "Expected RedirectToRouteResult to be returned");
            Assert.AreEqual(expectedAction, result.RouteValues["Action"]);
        }
        public void Create_Returns_To_Create_When_InValid()
        {
            // Arange
            Pier validPierToAdd = new Pier();

            string expectedViewName = "Create";
            PierController pierController = unityContainer.Resolve<PierController>();
            pierController.ModelState.AddModelError("Test Model Error", "An Error to test an invalid Model");

            // Act
            var result = pierController.Create(validPierToAdd) as ViewResult;

            // Asert
            Assert.IsNotNull(result, "Expected ViewResult to be returned");
            Assert.AreEqual(expectedViewName, result.ViewName);
        }
        public void Add_Schedule()
        {
            Pier pier = new Pier { Name = "Pier Test" };
            TimeTable timeTable = new TimeTable { Name = "Timetable Test" };
            Route route = new Route { Name = "Route Test", TimeTable = timeTable };

            // Add to database
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                ScheduleRepository scheduleRepository = new ScheduleRepository(ctx);
                scheduleRepository.Add(new Schedule { Pier = pier, Route = route, Time = new TimeSpan(1, 0, 0) });
                scheduleRepository.SaveChanges();
            }

            // Check that it is there
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                List<Schedule> schedules = ctx.Schedules.Where(schedule => schedule.Pier.Id == pier.Id && schedule.Route.Id == route.Id).ToList();
                Assert.AreEqual(1, schedules.Count());
            }
        }
Exemplo n.º 18
0
        public void addVesselsToPiers(Port port)
        {
            Pier firstPier  = port.getPiers()[0];
            Pier secondPier = port.getPiers()[1];
            Pier thirdPier  = port.getPiers()[2];
            Pier fourthPier = port.getPiers()[3];

            if (!firstPier.isFree)
            {
                firstPierServiceNow.Text = "id: " + firstPier.getCurrentServiceShip().getId().ToString() +
                                           "; " + "size: " +
                                           firstPier.getCurrentServiceShip().getSize().ToString() + "service time: " +
                                           firstPier.getCurrentServiceShip().getServiceTime().ToString();
            }

            if (!secondPier.isFree)
            {
                secondPierServiceNow.Text = "id: " + secondPier.getCurrentServiceShip().getId().ToString() +
                                            "; " + "size: " +
                                            secondPier.getCurrentServiceShip().getSize().ToString() + "service time: " +
                                            secondPier.getCurrentServiceShip().getServiceTime().ToString();
            }

            if (!thirdPier.isFree)
            {
                thirdPierServiceNow.Text = "id: " + thirdPier.getCurrentServiceShip().getId().ToString() +
                                           "; " + "size: " +
                                           thirdPier.getCurrentServiceShip().getSize().ToString() + "service time: " +
                                           thirdPier.getCurrentServiceShip().getServiceTime().ToString();
            }

            if (!fourthPier.isFree)
            {
                fourthPierServiceNow.Text = "id: " + fourthPier.getCurrentServiceShip().getId().ToString() +
                                            "; " + "size: " +
                                            fourthPier.getCurrentServiceShip().getSize().ToString() + "service time: " +
                                            fourthPier.getCurrentServiceShip().getServiceTime().ToString();
            }
        }
Exemplo n.º 19
0
        public void changePierData(Port port, int numberOfPier)
        {
            Pier firstPier  = port.getPiers()[0];
            Pier secondPier = port.getPiers()[1];
            Pier thirdPier  = port.getPiers()[2];
            Pier fourthPier = port.getPiers()[3];

            if (numberOfPier == 0)
            {
                firstPierTotalServ.Text = firstPier.getNumberOfShipsServ().ToString();
                firstPierSmallServ.Text = firstPier.getNumberOfSmallShipsServ().ToString();
                firstPierMedServ.Text   = firstPier.getNumberOfMedShipsServ().ToString();
                firstPierLargeServ.Text = firstPier.getNumberOfLargeShipsServ().ToString();
            }

            if (numberOfPier == 1)
            {
                secondPierTotalServ.Text = secondPier.getNumberOfShipsServ().ToString();
                secondPierSmallServ.Text = secondPier.getNumberOfSmallShipsServ().ToString();
                secondPierMedServ.Text   = secondPier.getNumberOfMedShipsServ().ToString();
                secondPierLargeServ.Text = secondPier.getNumberOfLargeShipsServ().ToString();
            }

            if (numberOfPier == 2)
            {
                thirdPierTotalServ.Text = thirdPier.getNumberOfShipsServ().ToString();
                thirdPierSmallServ.Text = thirdPier.getNumberOfSmallShipsServ().ToString();
                thirdPierMedServ.Text   = thirdPier.getNumberOfMedShipsServ().ToString();
                thirdPierLargeServ.Text = thirdPier.getNumberOfLargeShipsServ().ToString();
            }

            if (numberOfPier == 3)
            {
                fourthPierTotalServ.Text = fourthPier.getNumberOfShipsServ().ToString();
                fourthPierSmallServ.Text = fourthPier.getNumberOfSmallShipsServ().ToString();
                fourthPierMedServ.Text   = fourthPier.getNumberOfMedShipsServ().ToString();
                fourthPierLargeServ.Text = fourthPier.getNumberOfLargeShipsServ().ToString();
            }
        }
Exemplo n.º 20
0
        private bool UpdateObjects(IEnumerable <Panel> bhPanels)
        {
            bool sucess = true;

            foreach (Panel bhPanel in bhPanels)
            {
                Pier          pier     = bhPanel.Pier();
                Spandrel      spandrel = bhPanel.Spandrel();
                List <string> pl       = new List <string>();
                string        name     = bhPanel.CustomData[AdapterId].ToString();

                if (pier != null)
                {
                    int ret = m_model.PierLabel.SetPier(pier.Name);
                    ret = m_model.AreaObj.SetPier(name, pier.Name);
                }
                if (spandrel != null)
                {
                    int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false);
                    ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name);
                }
            }
            return(sucess);
        }
 /// <summary>
 /// Removes the pier label assignment of the object.
 /// </summary>
 /// <param name="app">The application.</param>
 protected void removePier(IPier app)
 {
     app.SetPier(Name, Constants.NONE);
     _pierName = string.Empty;
     _pier     = null;
 }
 /// <summary>
 /// Adds the pier label assignment of the object.
 /// </summary>
 /// <param name="app">The application.</param>
 /// <param name="pier">The pier assignment.</param>
 protected void addPier(IPier app, Pier pier)
 {
     app.SetPier(Name, pier.Name);
     _pierName = pier.Name;
     _pier     = pier;
 }
 /// <summary>
 /// Adds the pier label assignment to the object.
 /// Any existing pier label is replaced.
 /// </summary>
 /// <param name="pier">The pier assignment.</param>
 public abstract void AddToPier(Pier pier);
        public void Create_Does_Not_Calls_Save_When_InValid()
        {
            // Arange
            Pier validPierToAdd = new Pier();

            PierController pierController = unityContainer.Resolve<PierController>();
            pierController.ModelState.AddModelError("Test Model Error", "An Error to test an invalid Model");

            // Act
            var result = pierController.Create(validPierToAdd) as ViewResult;

            // Asert
            mockPierRepository.Verify(x => x.Add(validPierToAdd), Times.Never());
            mockPierRepository.Verify(x => x.SaveChanges(), Times.Never());
        }
        public void Create_Calls_Save_When_Valid()
        {
            // Arange
            Pier validPierToAdd = new Pier();

            PierController pierController = unityContainer.Resolve<PierController>();

            // Act
            var result = pierController.Create(validPierToAdd) as RedirectToRouteResult;

            // Asert
            mockPierRepository.Verify(x => x.Add(validPierToAdd), Times.Once());
            mockPierRepository.Verify(x => x.SaveChanges());
        }
 /// <summary>
 /// Adds the pier label assignment of the object.
 /// </summary>
 /// <param name="pier">The pier assignment.</param>
 protected void addPier(Pier pier)
 {
     _pierName = pier.Name;
     _pier     = pier;
 }
Exemplo n.º 27
0
 /// <summary>
 /// Adds the pier label assignment to the object.
 /// Any existing pier label is replaced.
 /// </summary>
 /// <param name="pier">The pier assignment.</param>
 public override void AddToPier(Pier pier)
 {
     addPier(_frameObject, pier);
 }
        public void Edit_Calls_Edit_When_Valid()
        {
            // Arange
            Pier validPierToEdit = new Pier { Id = 1, Name = "Pier 1" };
            
            PierController pierController = unityContainer.Resolve<PierController>();

            // Act
            var result = pierController.Edit(validPierToEdit) as RedirectToRouteResult;

            // Asert
            mockPierRepository.Verify(x => x.Update(validPierToEdit), Times.Once());
            mockPierRepository.Verify(x => x.SaveChanges());
        }
Exemplo n.º 29
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static Panel SetPier(this Panel panel, Pier pier)
        {
            panel.Fragments.AddOrReplace(pier);

            return(panel);
        }
Exemplo n.º 30
0
        /***************************************************/
        /***    Create Methods                           ***/
        /***************************************************/

        private bool CreateObject(Panel bhPanel)
        {
            bool success = true;
            int  retA    = 0;

            double mergeTol = 1e-3; //Merging panel points to the mm, same behaviour as the default node comparer

            if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges, true))
            {
                return(false);
            }

            for (int i = 0; i < bhPanel.ExternalEdges.Count; i++)
            {
                if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges[i], true))
                {
                    return(false);
                }

                if (!CheckPropertyError(bhPanel, bhP => bhP.ExternalEdges[i].Curve, true))
                {
                    return(false);
                }
            }

            NonLinearEdgesCheck(bhPanel.ExternalEdges);

            string name         = "";
            string propertyName = "";

            if (CheckPropertyWarning(bhPanel, bhP => bhP.Property))
            {
                propertyName = GetAdapterId <string>(bhPanel.Property);
            }

            List <BH.oM.Geometry.Point> boundaryPoints = bhPanel.ControlPoints(true).CullDuplicates(mergeTol);

            int segmentCount = boundaryPoints.Count();

            double[] x = new double[segmentCount];
            double[] y = new double[segmentCount];
            double[] z = new double[segmentCount];
            for (int i = 0; i < segmentCount; i++)
            {
                x[i] = boundaryPoints[i].X;
                y[i] = boundaryPoints[i].Y;
                z[i] = boundaryPoints[i].Z;
            }

            retA = m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref name, propertyName);
            ETABSId etabsid = new ETABSId();

            etabsid.Id = name;

            //Label and story
            string label = "";
            string story = "";
            string guid  = null;

            if (m_model.AreaObj.GetLabelFromName(name, ref label, ref story) == 0)
            {
                etabsid.Label = label;
                etabsid.Story = story;
            }

            if (m_model.AreaObj.GetGUID(name, ref guid) == 0)
            {
                etabsid.PersistentId = guid;
            }

            bhPanel.SetAdapterId(etabsid);

            if (retA != 0)
            {
                return(false);
            }

            if (bhPanel.Openings != null)
            {
                for (int i = 0; i < bhPanel.Openings.Count; i++)
                {
                    if (!CheckPropertyError(bhPanel, bhP => bhP.Openings[i]))
                    {
                        continue;
                    }

                    Opening opening = bhPanel.Openings[i];

                    for (int j = 0; j < opening.Edges.Count; j++)
                    {
                        if (!CheckPropertyError(opening, o => o.Edges[j], true))
                        {
                            return(false);
                        }

                        if (!CheckPropertyError(opening, o => o.Edges[j], true))
                        {
                            return(false);
                        }
                    }

                    NonLinearEdgesCheck(opening.Edges);

                    boundaryPoints = opening.ControlPoints().CullDuplicates(mergeTol);

                    segmentCount = boundaryPoints.Count();
                    x            = new double[segmentCount];
                    y            = new double[segmentCount];
                    z            = new double[segmentCount];

                    for (int j = 0; j < segmentCount; j++)
                    {
                        x[j] = boundaryPoints[j].X;
                        y[j] = boundaryPoints[j].Y;
                        z[j] = boundaryPoints[j].Z;
                    }

                    string openingName = name + "_Opening_" + i;
                    m_model.AreaObj.AddByCoord(segmentCount, ref x, ref y, ref z, ref openingName, "");//<-- setting panel property to empty string, verify that this is correct
                    m_model.AreaObj.SetOpening(openingName, true);

                    SetAdapterId(bhPanel.Openings[i], openingName);
                }
            }

            //Set local orientations:
            Basis orientation = bhPanel.LocalOrientation();

            m_model.AreaObj.SetLocalAxes(name, Convert.ToEtabsPanelOrientation(orientation.Z, orientation.Y));

            Pier      pier      = bhPanel.Pier();
            Spandrel  spandrel  = bhPanel.Spandrel();
            Diaphragm diaphragm = bhPanel.Diaphragm();

            if (pier != null)
            {
                int ret = m_model.PierLabel.SetPier(pier.Name);
                ret = m_model.AreaObj.SetPier(name, pier.Name);
            }
            if (spandrel != null)
            {
                int ret = m_model.SpandrelLabel.SetSpandrel(spandrel.Name, false);
                ret = m_model.AreaObj.SetSpandrel(name, spandrel.Name);
            }
            if (diaphragm != null)
            {
                m_model.AreaObj.SetDiaphragm(name, diaphragm.Name);
            }
            return(success);
        }
        public void Add_Or_Update_Schedule()
        {
            Pier pier = new Pier { Name = "Pier" };
            TimeTable timeTable = new TimeTable { Name = "TimeTable" };
            Route routeExisting = new Route { Name = "Route1", TimeTable = timeTable };
            Route routeAdd = new Route { Name = "Route2", TimeTable = timeTable };

            TimeSpan timeExisting = new TimeSpan(13, 0, 0);
            TimeSpan timeAdd = new TimeSpan(14, 0, 0);
            TimeSpan timeUpdated = new TimeSpan(15, 0, 0);

            Schedule existing = new Schedule { Pier = pier, Route = routeExisting, Time = timeExisting };
            Schedule add = new Schedule { Pier = pier, Route = routeAdd, Time = timeAdd };

            // Add the existing one to database
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                ScheduleRepository scheduleRepository = new ScheduleRepository(ctx);
                scheduleRepository.Add(existing);
                scheduleRepository.SaveChanges();
            }

            // Find and update it
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                ScheduleRepository scheduleRepository = new ScheduleRepository(ctx);
                existing.Time = timeUpdated;
                scheduleRepository.AddOrUpate(existing);
                scheduleRepository.AddOrUpate(add);
                scheduleRepository.SaveChanges();
            }

            // Check that the new name is there
            using (ThamesClipperContext ctx = new ThamesClipperContext())
            {
                var schedulesExisting = ctx.Schedules.Where(schedule => schedule.Pier.Id == pier.Id && schedule.Route.Id == routeExisting.Id).ToList();
                Assert.AreEqual(1, schedulesExisting.Count());
                Assert.AreEqual(timeUpdated, schedulesExisting[0].Time);

                var schedulesAdd = ctx.Schedules.Where(schedule => schedule.Pier.Id == pier.Id && schedule.Route.Id == routeAdd.Id).ToList();
                Assert.AreEqual(1, schedulesAdd.Count());
            }
        }
Exemplo n.º 32
0
        public virtual void InitBoard()
        {
            Track[,] boardArray = new Track[9, 11];
            int totalX = 0;

            for (int x = 0; x < model.height; x++)
            {
                for (int y = 0; y < model.width; y++)
                {
                    totalX++;
                    var c = model.boardString[totalX];
                    switch (c)
                    {
                    case 'B':
                        boardArray[x, y]         = new EmptyTrack();
                        boardArray[x, y].content = new Boat(boardArray[x, y]);
                        model.boat        = (Boat)boardArray[x, y].content;
                        model.boat.onPier = true;
                        break;

                    case '-':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 0;
                        break;

                    case 'K':
                        boardArray[x, y] = new Pier();
                        break;

                    case 'a':
                        boardArray[x, y] = new ArrangeTrack();
                        break;

                    case '1':
                    case '2':
                    case '3':
                        boardArray[x, y]                  = new Track();
                        model.Routes[c - '1']             = new Route();
                        model.Routes[c - '1'].OriginField = boardArray[x, y];
                        break;

                    case '@':
                        boardArray[x, y] = new MovableTrack();
                        model.MovableTracks.Add((MovableTrack)boardArray[x, y]);
                        break;

                    case ' ':
                        boardArray[x, y] = new EmptyTrack();
                        break;

                    case '┐':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 1;
                        break;

                    case '┌':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 2;
                        break;

                    case '┘':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 3;
                        break;

                    case '└':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 4;
                        break;

                    case '|':
                        boardArray[x, y]        = new Track();
                        boardArray[x, y].corner = 5;
                        break;

                    default:
                        break;
                    }

                    boardArray[x, y].x = x;
                    boardArray[x, y].y = y;
                }
            }
            model.boardArray = boardArray;
            model.MovableTracks[0].corner = 2;
            model.MovableTracks[1].corner = 1;
            model.MovableTracks[2].corner = 2;
            model.MovableTracks[3].corner = 2;
            model.MovableTracks[4].corner = 1;
            InitNeighbours();
        }
        public void Update_Route_Name()
        {
            // Arange
            List<Schedule> schedules = new List<Schedule>();
            int numberOfSchedules = 10;
            string oldName = "RouteName";

            for (int i = 0; i < numberOfSchedules; i++)
            {
                Pier pier = new Pier { Id = i, Name = "Pier " + i };
                schedules.Add(new Schedule { Time = new TimeSpan(i, 0, 0), Pier = pier });
            }

            Route route = new Route { Name = oldName, Schedules = schedules };

            // Act
            route.UpdateName();

            // Assert
            Assert.AreEqual(route.Name, "00:00 Pier 0 to Pier 9");
        }
 /// <summary>
 /// Removes the pier label assignment of the object.
 /// </summary>
 protected void removePier()
 {
     _pierName = string.Empty;
     _pier     = null;
 }
Exemplo n.º 35
0
 /// <summary>
 /// Retrieves the pier label assignments of an object.
 /// </summary>
 /// <param name="app">The application.</param>
 protected void getPier(IPier app)
 {
     Pier = Pier.Factory(app.GetPier(Name));
 }
Exemplo n.º 36
0
 /// <summary>
 /// Adds the pier label assignment to the object.
 /// Any existing pier label is replaced.
 /// </summary>
 /// <param name="pier">The pier assignment.</param>
 public override void AddToPier(Pier pier)
 {
     addPier(_areaObject, pier);
 }