public async Task EntityController_Update_WithNoFieldsAltered_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "Invoice Line"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line }; 

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			var returnValue = controller.AddEntityToManagedEntitiesCollection(invoice);

			Assert.IsTrue(returnValue);

			await entityController.UpdateAsync(invoice);
			string data = controllerMock.Data;
			Assert.AreEqual("", data);
		}
		public async Task EntityController_Update_WithNewLinkedEntity_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var apiConnectorMock = new ApiConnectorMock();
			var controllerList = new ControllerList(apiConnectorMock, "https://start.exactonline.nl/api/v1/");

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var invoice = new SalesInvoice {Description = "New Description"};
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);

			// Change State
			invoice.Description = "Description2";
			var line = new SalesInvoiceLine {Description = "InvoiceLine2"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line }; 

			await entityController.UpdateAsync(invoice);

			string data = controllerMock.Data;
			Assert.IsTrue(data.Contains(@"""Description"":""Description2"""));
			Assert.IsTrue(data.Contains(@"""Description"":""InvoiceLine2"""));
		}
		public async Task EntityController_Update_WithExistingLinkedEntity_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "InvoiceLine"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line };

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var entityController = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

			// Change State
			invoice.Description = "Description2";
			line.Description = "InvoiceLine2";

			await entityController.UpdateAsync(invoice);
			string data = controllerMock.Data;
			Assert.AreEqual(@"{""Description"":""Description2"",""SalesInvoiceLines"":[{""Description"":""InvoiceLine2""}]}", data);
		}
		public async Task EntityController_Update_WithOnlyLinkedEntityFieldsAltered_Succeeds()
		{
			var controllerMock = new ApiConnectionEntityControllerMock();
			var connector = new ApiConnectorMock();
			var controllerList = new ControllerList(connector, "https://start.exactonline.nl/api/v1/");

			var invoice = new SalesInvoice {Description = "New Description"};
			var line = new SalesInvoiceLine {Description = "InvoiceLine"};
			invoice.SalesInvoiceLines = new List<SalesInvoiceLine> { line };

			var controller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
			var ec = new EntityController(invoice, "ID", invoice.InvoiceID.ToString(), controllerMock, controller.GetEntityController);
			Assert.IsTrue(controller.AddEntityToManagedEntitiesCollection(invoice));

			// Change State
			line.Description = "InvoiceLine2";
			await ec.UpdateAsync(invoice);

			string result = controllerMock.Data;
			const string expected = "{\"SalesInvoiceLines\":[{\"Description\":\"InvoiceLine2\"}]}";
			Assert.AreEqual(expected, result);
		}
        public void Controller_Test_ManagedEntities_WithLinkedEntities_Succeeds()
        {
            // Test if controller registrates linked entities
            IApiConnector conn = new ApiConnectorControllerMock();
            var controllerList = new ControllerList(conn, string.Empty);

            var salesinvoicecontroller = (Controller<SalesInvoice>)controllerList.GetController<SalesInvoice>();
            var invoicelines = (Controller<SalesInvoiceLine>)controllerList.GetController<SalesInvoiceLine>();
            salesinvoicecontroller.GetManagerForEntity = controllerList.GetEntityManager;

            // Verify if sales invoice lines are registrated entities
            var invoice = salesinvoicecontroller.Get("")[0];
            SalesInvoiceLine line = ((List<SalesInvoiceLine>)invoice.SalesInvoiceLines)[0];
            Assert.IsTrue(invoicelines.IsManagedEntity(line), "SalesInvoiceLine isn't a managed entity");
        }
        private void ConstructPhysicsSimulator(Vector2 gravity)
        {
            geomList = new GeomList();
            geomAddList = new List<Geom>();
            geomRemoveList = new List<Geom>();

            bodyList = new BodyList();
            bodyAddList = new List<Body>();
            bodyRemoveList = new List<Body>();

            controllerList = new ControllerList();
            controllerAddList = new List<Controller>();
            controllerRemoveList = new List<Controller>();

            jointList = new JointList();
            jointAddList = new List<Joint>();
            jointRemoveList = new List<Joint>();

            springList = new SpringList();
            springAddList = new List<Spring>();
            springRemoveList = new List<Spring>();

            _broadPhaseCollider = new SelectiveSweepCollider(this);

            arbiterList = new ArbiterList();
            _gravity = gravity;

            arbiterPool = new Pool<Arbiter>(_arbiterPoolSize);

            #region Added by Daniel Pramel 08/17/08

            _inactivityController = new InactivityController(this);

            _scaling = new Scaling(0.001f, 0.01f);

            #endregion
        }