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);
		}