Пример #1
0
 public void ValidateDynamicEntityGetTypes()
 {
     Assert.That(entityWithAllTypes.GetBinary("binary"), Is.InstanceOf(typeof(byte[])));
     Assert.That(entityWithAllTypes.GetBoolean("boolean"), Is.InstanceOf(typeof(bool)));
     Assert.That(entityWithAllTypes.GetDateTime("datetime"), Is.InstanceOf(typeof(DateTime)));
     Assert.That(entityWithAllTypes.GetDouble("double"), Is.InstanceOf(typeof(double)));
     Assert.That(entityWithAllTypes.GetGuid("guid"), Is.InstanceOf(typeof(Guid)));
     Assert.That(entityWithAllTypes.GetInt32("int32"), Is.InstanceOf(typeof(int)));
     Assert.That(entityWithAllTypes.GetInt64("int64"), Is.InstanceOf(typeof(long)));
 }
Пример #2
0
        public void ValidateDynamicEntitySetType()
        {
            var entity = new DynamicTableEntity("partition", "row")
            {
                { "exampleBool", true }
            };

            // Test setting an existing property with the same type works.
            entity["exampleInt"] = false;
            Assert.That(entity.GetBoolean("exampleInt"), Is.False);
        }