예제 #1
0
        //public void save()
        //{
        //   // Dirty = false;
        //    this.save(new DefaultProgressNotifier());
        //}

        //TODO mark with a "Are you sure you want to close" if marked Dirty=True
        public virtual void close()
        {
            ParentController.Tabs.MouseMove  -= mouseMoveHandle;
            ParentController.Tabs.MouseLeave -= mouseMoveHandle;
            //ParentController.Tabs.MouseClick -= mouseClickHandle;
            ParentController.closeDocument(FileName);
        }
        public void PutParent(Parent pro)
        {
            var context = new TaskTestContext();

            context.Parent.Add(pro);
            ParentController controller = new ParentController(context);

            controller.Request = new HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            controller.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage http;

            http = controller.Put(pro.Parent_Id, pro);
            Assert.AreEqual(HttpStatusCode.Created, http.StatusCode);
            var response = http.Content.ReadAsStringAsync().Result
                           .Replace("\\", "")
                           .Trim(new char[1] {
                '"'
            });
            List <Parent> _list = JsonConvert.DeserializeObject <List <Parent> >(response);

            Assert.IsNotNull(_list);
            Assert.AreEqual(pro.Parent_Task, _list[0].Parent_Task);
            Assert.AreEqual(pro.Project_Id, _list[0].Project_Id);
            Assert.AreEqual(pro.Parent_Id, _list[0].Parent_Id);
        }
예제 #3
0
        /// <summary>
        /// Raises the Closing event.
        /// </summary>
        /// <param name="e">An CancelEventArgs that contains the event
        /// data.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            // Notify the controller we are closing.
            e.Cancel = !ParentController.Exit();
        }
예제 #4
0
 void Start()
 {
     health                = 100;
     healthText.text       = string.Format("Health: {0}", health);
     audioSource           = GetComponent <AudioSource>();
     playthroughController = GetComponent <GrowlerPlaythroughUpdated>();
     parentController      = GetComponent <ParentController>();
 }
예제 #5
0
        public void TestForCorrectReturnStudentEGNParentForm()
        {
            var    parent    = new ParentController();
            string EGNparent = "1234567891";
            string action    = "3376299241";
            var    result    = parent.StudentEGNFromParent(EGNparent);

            Assert.AreEqual(action, result, "Return student egn if input for parent egn exists in database/parent");
        }
예제 #6
0
        public void TestForCorrectSetParentName()
        {
            var    parent        = new ParentController();
            string egnParentPass = "******";
            var    result        = parent.SetFirstLastName(egnParentPass);
            var    name          = "Mitko Minkov";

            Assert.AreEqual(name, result, "Correct set First and Last name for parent in parentForm");
        }
        public void GetParentTasksTest()
        {
            ParentController controller = new ParentController();

            _counter.Increment();
            var result = controller.GetParentTasks();

            Assert.IsNotNull(result);
        }
        public void UpdateParent()
        {
            parent = new Parent {
                ParentId = 1, FamilyId = 2, Firstname = "b", Lastname = "b", DateOfBirth = DateTime.Now, Gender = "M"
            };
            ParentController pc = new ParentController(new FakeParentRepository(false));

            Assert.IsInstanceOfType(pc.Create(parent), typeof(ActionResult));
        }
예제 #9
0
    public void Pay()
    {
        PlacesController pCtrl      = Spaces.transform.GetChild(CurrentSpace).GetComponent <PlacesController>();
        ParentController placeOwner = pCtrl.Owner.GetComponent <ParentController>();

        ChangeMoney(Operation.SUB, pCtrl.GetRent());
        placeOwner.ChangeMoney(0, pCtrl.GetRent());

        Finish();
    }
예제 #10
0
        public void ParentGetBenchMark(BenchmarkContext context)
        {
            ParentController parent = new ParentController();

            parent.Request = new HttpRequestMessage();
            parent.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            parent.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage _http;

            _http = parent.Get();
            parentCounter.Increment();
        }
예제 #11
0
    public override bool Finished()
    {
        var self = ParentController.Self;

        if (self.CurrentTile == null)
        {
            self.CurrentTile = _area.AreaTiles[(int)self.CurrentPosition.y,
                                               (int)self.CurrentPosition.x];
        }

        return(!ParentController.IsMobile() || _numVisits > MaxVisits || self.CurrentTile.X == _x &&
               self.CurrentTile.Y == _y);
    }
        private void OkAction()
        {
            var selectedChampionship = _championshipsSelectionViewModel.SelectedChampionship;

            _selectionWindow.Close();

            if (selectedChampionship == null)
            {
                return;
            }

            ParentController.StartNextEvent(selectedChampionship.OriginalModel);
        }
        public void GetTasksByID(Parent _task)
        {
            //tets get by id
            ParentController p = new ParentController();

            p.Request = new HttpRequestMessage();
            p.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            p.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage _http;

            _http = p.Get(_task.Parent_Id);
            Assert.AreEqual(HttpStatusCode.OK, _http.StatusCode);
        }
        public void InitializeTest()
        {
            List <Parent_Task> parentTaskList = new List <Parent_Task>();

            parentTaskList.Add(new Parent_Task
            {
                ParentID   = 1,
                ParentTask = "ParentTask1"
            });
            mockParentRepository.Setup(x => x.GetAll()).Returns(parentTaskList);

            controller = new ParentController();
            controller.parentRepository = mockParentRepository.Object;
        }
예제 #15
0
        public void TestProject()
        {
            ParentController oController = new ParentController();



            HttpResponseMessage res = oController.Get();
            string message          = pResult.status.Message;

            Assert.AreEqual("Project added successfully", message);
            testProject.Project_ID = pResult.project.Project_ID;
            Assert.AreEqual("Project updated successfully", oController.Post(testProject).status.Message);
            Assert.IsNotNull(oController.Get());
        }
        public void DeleteParentNullCheck(Parent pro)
        {
            var context = new TaskTestContext();

            context.Parent.Add(pro);
            ParentController controller = new ParentController(context);

            controller.Request = new HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            controller.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage http;

            http = controller.Delete(-1);
            Assert.AreEqual(HttpStatusCode.Conflict, http.StatusCode);
        }
    public void Init(HUDController hudController)
    {
        _hudController = hudController;

        PlayerCombatView view = GameObject.Instantiate <PlayerCombatView>(_gameplayResources.playerCombatView);

        _playerCombatController = new PlayerCombatController(view, _gameConfig.playerConfig);
        _playerCombatController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnPlayeDamageTake);

        _gameplayCam      = GameObject.FindObjectOfType <GameplayCamera>();
        _combatCamera     = new CombatCamera(_gameplayCam, _playerCombatController.transform);
        _parentController = GameObject.Instantiate <ParentController>(_gameplayResources.parentController);
        _parentController.Init(_gameConfig.playerConfig);
        _parentController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnParentDamageTaken);
    }
        public void GetParentByIDNULLCheck(Parent pro)
        {
            var context = new TaskTestContext();

            context.Parent.Add(pro);
            ParentController controller = new ParentController(context);

            controller.Request = new HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            controller.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage http;

            http = controller.Get(-1);
            Assert.AreEqual(HttpStatusCode.NotFound, http.StatusCode);
        }
예제 #19
0
    public override void TakeAction()
    {
        if (!ParentController.IsMobile())
        {
            FailToParent();
            return;
        }
        if (ParentController.Self.CurrentArea == null)
        {
            Pop();
            return;
        }
        if (_area == null)
        {
            Pop();
            return;
        }
        if (_monoHelper == null)
        {
            _monoHelper = ParentController.Self.GetSprite().AddComponent <MonoHelper>();
        }

        ParentController.FindPathToTarget(
            new Vector2(ParentController.Self.CurrentPosition.x, ParentController.Self.CurrentPosition.y), new Vector2(_y, _x));

        if (ParentController.Path.vectorPath.Count > 1)
        {
            var translatedPath = TranslatePathToDirections();
            var numTurns       = 0;
            foreach (var node in translatedPath)
            {
                PushGoal(new Step(node));
                numTurns++;
                if (_maxTurns > -1 && numTurns >= _maxTurns)
                {
                    break;
                }
            }
        }
        else
        {
            FailToParent();
        }
        _numVisits++;
    }
        public BreadcrumbAttribute GetParent(Type defaultController, Dictionary <string, object> attributeParameters)
        {
            if (ParentAction == null)
            {
                return(null);
            }

            MethodBase parentActionMethod = ParentController.GetMethod(ParentAction);
            var        parentAttribute    = parentActionMethod.GetCustomAttribute <BreadcrumbAttribute>();

            var resolveAttributes = parentActionMethod.GetCustomAttributes <ResolverAttribute>();

            resolveAttributes.ToList().ForEach(attribute =>
            {
                var resolver = attributeParameters[attribute.ResolverKey];
                attribute.Resolve(resolver).ToList().ForEach(resolvedAttribute =>
                {
                    attributeParameters.Add(resolvedAttribute.Key, resolvedAttribute.Value);
                });
            });

            //TODO: add additional arguments over attributes

            if (parentAttribute.ParentController == null)
            {
                parentAttribute.ParentController = defaultController;
            }

            if (parentAttribute.Url == null)
            {
                var prefixAttribute = parentAttribute.ParentController.GetCustomAttribute <RoutePrefixAttribute>();
                var routeAttribute  = parentActionMethod.GetCustomAttribute <RouteAttribute>();

                //TODO: auto-resolve using default routing (controller + action name)?
                var prefix = prefixAttribute?.Prefix ?? string.Empty;
                var route  = routeAttribute?.Template ?? string.Empty;

                parentAttribute.Url = prefix + "/" + route;
                parentAttribute.Url = parentAttribute.ApplyAttributes(parentAttribute.Url, attributeParameters);
            }

            parentAttribute.Text = parentAttribute.ApplyAttributes(parentAttribute.Text, attributeParameters);

            return(parentAttribute);
        }
예제 #21
0
 /// <summary>
 /// Override GetHashCode for object
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = 1;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentController != null ? ParentController.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentAction != null ? ParentAction.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentArea != null ? ParentArea.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Area != null ? Area.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Controller != null ? Controller.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Action != null ? Action.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ControllerSecurity != null ? ControllerSecurity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ActionSecurity != null ? ActionSecurity.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public void GetTasks()
        {
            //test get
            ParentController p = new ParentController();

            p.Request = new HttpRequestMessage();
            p.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            p.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage _http;

            try {
                _http = p.Get();
                Assert.AreEqual(HttpStatusCode.OK, _http.StatusCode);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e.Message.Contains("Error"));
            }
        }
        public void DeleteParent(Parent pro)
        {
            var context = new TaskTestContext();

            context.Parent.Add(pro);
            ParentController controller = new ParentController(context);

            controller.Request = new HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            controller.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage http;

            http = controller.Delete(pro.Parent_Id);
            Assert.AreEqual(HttpStatusCode.OK, http.StatusCode);
            var response = http.Content.ReadAsStringAsync().Result
                           .Replace("\\", "")
                           .Trim(new char[1] {
                '"'
            });

            Assert.AreEqual(pro.Parent_Id.ToString(), response);
        }
        public void PostPost(Parent _task)
        {
            //test post
            _task.Parent_Id = 0;
            ParentController p = new ParentController();

            p.Request = new HttpRequestMessage();
            p.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            p.Request.SetConfiguration(new HttpConfiguration());
            HttpResponseMessage _http;

            _http = p.Post(_task);
            Assert.AreEqual(HttpStatusCode.Created, _http.StatusCode);
            Assert.GreaterOrEqual(_task.Parent_Id, 0);
            //test get by id
            _http = p.Get(_task.Parent_Id);
            Assert.AreEqual(HttpStatusCode.OK, _http.StatusCode);
            Assert.GreaterOrEqual(_task.Parent_Id, 0);
            //test delete
            _http = p.Delete(_task);
            Assert.AreEqual(HttpStatusCode.OK, _http.StatusCode);
        }
예제 #25
0
        public bool mouseInIcon()
        {
            if (TabNumber >= ParentController.Tabs.TabCount)
            {
                return(false);
            }

            Point     pos  = ParentController.PointToClient(Cursor.Position);
            Rectangle rect = ParentController.Tabs.GetTabRect(TabNumber);

            if (pos.X > rect.Left + 5 &&
                pos.X < rect.Right - rect.Width + 25 &&
                pos.Y < rect.Bottom &&
                pos.Y > rect.Top)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #26
0
    public override void TakeAction()
    {
        if (!ParentController.IsMobile())
        {
            Pop();
            return;
        }

        var directionDictionary = GlobalHelper.GetVectorDictionary();

        var currentPosition = new Vector2(ParentController.Self.CurrentTile.X, ParentController.Self.CurrentTile.Y);
        var targetposition  = new Vector2(
            (int)(currentPosition.x + directionDictionary[StepDirection].x),
            (int)(currentPosition.y + directionDictionary[StepDirection].y));

        if (!ParentController.Self.AreaMapCanMoveLocal(targetposition))
        {
            FailToParent();
            return;
        }
        ParentController.Self.AreaMove(targetposition);
        Pop();
    }
예제 #27
0
 //initialization
 void Start()
 {
     parent = transform.parent.GetComponent <ParentController>();
 }
        public void DeleteParent()
        {
            ParentController pc = new ParentController(new FakeParentRepository());

            Assert.IsInstanceOfType(pc.DeleteConfirmed(1), typeof(ActionResult));
        }
예제 #29
0
 private void FinishCurrentEvent(SimulatorDataSet simulatorDataSet)
 {
     Logger.Info($"Finishing event for {_runningChampionship.ChampionshipName}");
     IsChampionshipActive = false;
     ParentController.EventFinished(_runningChampionship);
 }
        public void ReadParent()
        {
            ParentController pc = new ParentController(new FakeParentRepository());

            Assert.IsInstanceOfType(pc.Details(1), typeof(ActionResult));
        }