public void TableRetrieveEntityPropertySetter() { CloudTableClient tableClient = GenerateCloudTableClient(); string pk = Guid.NewGuid().ToString(); // Add insert ComplexEntity sendEnt = new ComplexEntity(); sendEnt.PartitionKey = pk; sendEnt.RowKey = Guid.NewGuid().ToString(); Dictionary<string, EntityProperty> properties = new Dictionary<string, EntityProperty>(); EntityProperty prop1 = properties["BoolN"] = EntityProperty.GeneratePropertyForBool(null); sendEnt.BoolN = prop1.BooleanValue = true; EntityProperty prop2 = properties["DoubleN"] = EntityProperty.GeneratePropertyForDouble(null); sendEnt.DoubleN = prop2.DoubleValue = 3.1415; EntityProperty prop3 = properties["GuidN"] = EntityProperty.GeneratePropertyForGuid(null); sendEnt.GuidN = prop3.GuidValue = Guid.NewGuid(); EntityProperty prop4 = properties["Int32N"] = EntityProperty.GeneratePropertyForInt(null); sendEnt.Int32N = prop4.Int32Value = 1; EntityProperty prop5 = properties["Int64N"] = EntityProperty.GeneratePropertyForLong(null); sendEnt.Int64N = prop5.Int64Value = 1234; EntityProperty prop6 = properties["String"] = EntityProperty.GeneratePropertyForString(null); sendEnt.String = prop6.StringValue = "hello"; EntityProperty prop7 = properties["DateTimeOffsetN"] = EntityProperty.GeneratePropertyForDateTimeOffset(null); sendEnt.DateTimeOffsetN = prop7.DateTimeOffsetValue = DateTimeOffset.UtcNow; ComplexEntity retrievedEntity = new ComplexEntity(); retrievedEntity.ReadEntity(properties, null); Assert.AreEqual(sendEnt.BoolN, retrievedEntity.BoolN); Assert.AreEqual(sendEnt.DoubleN, retrievedEntity.DoubleN); Assert.AreEqual(sendEnt.GuidN, retrievedEntity.GuidN); Assert.AreEqual(sendEnt.Int32N, retrievedEntity.Int32N); Assert.AreEqual(sendEnt.Int64N, retrievedEntity.Int64N); Assert.AreEqual(sendEnt.String, retrievedEntity.String); Assert.AreEqual(sendEnt.DateTimeOffsetN, retrievedEntity.DateTimeOffsetN); }
public void ReflectionBasedSerializationTest() { ComplexEntity ent = new ComplexEntity(); ComplexEntity secondEnt = new ComplexEntity(); secondEnt.ReadEntity(ent.WriteEntity(null), null); ComplexEntity.AssertEquality(ent, secondEnt); }