public async Task EntityConverter_ConvertObjectToJson_ForCreating_Succeeds()
		{
			// Test if objects is converted to json correctly
			var dateTimeEpoc = new DateTime(1970, 1, 1, 0, 0, 0, 0);

			#region Client Object and Json
			
			var simpleEntity = new SimpleEntity()
			{
				Code = "123",
				Description = "FOO",
				Id = new Guid("53697fab-137f-4242-b710-0139886b50f4"),
				StartDate = dateTimeEpoc.AddMilliseconds(1387188617287),
				EndDate = null,
				Boolean = true,
				NullableBoolean = null,				
				Integer = 5,
				NullableInteger = null
			};

			const string expected = "{\"Code\":\"123\",\"Description\":\"FOO\",\"Id\":\"53697fab-137f-4242-b710-0139886b50f4\",\"StartDate\":\"2013-12-16T10:10:17.287\",\"EndDate\":null,\"Boolean\":true,\"NullableBoolean\":null,\"Integer\":5,\"NullableInteger\":null}";
			#endregion

			var converter = new EntityConverter();
			string result = await converter.ConvertObjectToJsonAsync(simpleEntity, null);
			
			Assert.AreEqual(expected, result);
		}
		/// <summary>
		/// Updates the entity
		/// </summary>
		/// <returns>True if the entity is updated</returns>
		public async Task<bool> UpdateAsync(object entity)
		{
			// Convert object to json
			var converter = new EntityConverter();
			string json = await converter.ConvertObjectToJsonAsync(OriginalEntity, entity, _entityControllerDelegate);

			// Update entire object
			Boolean returnValue = false;

			// Update and set _originalentity to current entity (_entity)
			if (await _connection.PutAsync(_keyName, _identifier, json))
			{
				returnValue = true;
				OriginalEntity = Clone(entity);
			}
			return returnValue;
		}
		public async Task EntityConverter_ConvertExistingLinkedObjectToJson_Succeeds()
		{
			// Create Object
			var newInvoice = new SalesInvoice {InvoiceID = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")};
			var newInvoiceLine = new SalesInvoiceLine {Description = "NewInvoiceForEntityWithCollection"};
			newInvoice.SalesInvoiceLines = new List<SalesInvoiceLine> { newInvoiceLine };

			//ControllerSingleton.GetInstance(new MockObjects.MAPIConnector_Controller(), "www.dummy.com/");
			var entityController = new EntityController(newInvoice, "ID", "4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d", new MockObjects.ApiConnectionMock(), null);
			newInvoiceLine.Description = "ChangedNewInvoiceForEntityWithCollection";

			var entityConverter = new EntityConverter();
			var controllerDelegate = new GetEntityController(GetEntityController);
			string json = await entityConverter.ConvertObjectToJsonAsync((SalesInvoice)entityController.OriginalEntity, newInvoice, controllerDelegate);

			const string expected = "{\"SalesInvoiceLines\": [{\"Description\": \"ChangedNewInvoiceForEntityWithCollection\"}]}";
			Assert.AreEqual(expected, json);

			throw new NotImplementedException();
		}
		public async Task EntityConverter_ConvertEmptyLinkedObjectToJson_Succeeds()
		{
			// Create Object
			var newInvoice = new ComplexEntity
				{
					Currency = "EUR",
					OrderDate = new DateTime(2012, 10, 26),
					InvoiceTo = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
					Journal = "50",
					OrderedBy = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
					Description = "NewInvoiceForEntityWithCollection"
				};

			var entityConverter = new EntityConverter();
			string json = await entityConverter.ConvertObjectToJsonAsync(newInvoice, null);
			string expected = JsonFileReader.GetJsonFromFileWithoutWhiteSpace("Expected_Json_Object_ComplexEntity_WithEmptyLinkedEntities.txt");
			Assert.AreEqual(expected, json);
		}
		public async Task EntityConverter_ConvertLinkedObjectToJson_Succeeds()
		{
			// Create Object
			var newInvoice = new ComplexEntity
				{
					Currency = "EUR",
					OrderDate = new DateTime(2012, 10, 26),
					InvoiceTo = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
					Journal = "50",
					OrderedBy = new Guid("3734121e-1544-4b77-9ae2-7203e9bd6046"),
					Description = "NewInvoiceForEntityWithCollection"
				};

			var newInvoiceLine = new ComplexEntityLine
				{
					Description = "NewInvoiceForEntityWithCollection",
					Item = new Guid("4f68481a-7a2c-4fbc-a3a0-0c494df3fa0d")
				};

			var invoicelines = new List<ComplexEntityLine> { newInvoiceLine };
			newInvoice.Lines = invoicelines;

			var entityConverter = new EntityConverter();
			string json = await entityConverter.ConvertObjectToJsonAsync(newInvoice, null);
			string expected = JsonFileReader.GetJsonFromFileWithoutWhiteSpace("Expected_Json_Object_ComplexEntity_WithLinkedEntity.txt");
			Assert.AreEqual(expected, json);
		}
		public async Task EntityConverter_CreateWithoutGuid_Succeeds()
		{
			var newAccount = new Account { ID = new Guid() };
			var entityConverter = new EntityConverter();
			const string expected = "";

			var result = await entityConverter.ConvertObjectToJsonAsync(new Account(), newAccount, null);

			Assert.AreEqual(expected, result);
		}
		public async Task EntityConverter_CreateWithGuid_Succeeds()
		{
			var newAccount = new Account { ID = new Guid("8f8b8025-90b3-4307-a8a3-a5111d048fb5") };
			var entityConverter = new EntityConverter();
			const string expected = "{\"ID\":\"8f8b8025-90b3-4307-a8a3-a5111d048fb5\"}";

			var result = await entityConverter.ConvertObjectToJsonAsync(new Account(), newAccount, null);

			Assert.AreEqual(expected, result);
		}
		public async Task EntityConverter_ConvertObjectToJson_WithReadonlyFields_Succeeds()
		{
			var newAccount = new Account { AccountManagerHID = 10 };
			var entityConverter = new EntityConverter();
			const string expected = "";

			var result = await entityConverter.ConvertObjectToJsonAsync(new Account(), newAccount, null);

			Assert.AreEqual(expected, result);
		}
		public async Task EntityConverter_ConvertObjectToJson_ForNoAlteredFields_Succeeds()
		{
			var oldAccount = new Account { Name = "New Account" };
			var newAccount = new Account { Name = "New Account" };
			var entityConverter = new EntityConverter();
			const string expected = "";

			var result = await entityConverter.ConvertObjectToJsonAsync(oldAccount, newAccount, null);

			Assert.AreEqual(expected, result);
		}