예제 #1
0
 public void GetEntityTypeData_InvalidMap()
 {
     // Arrange & Act & Asset
     Assert.Throws <ArgumentOutOfRangeException>(() =>
     {
         EntityTypeDataFactory.GetEntityTypeData <AddressInvalidMap>();
     });
 }
예제 #2
0
 public void GetEntityTypeData_InvalidPropertyMap()
 {
     // Act & Assert
     Assert.Throws <ArgumentException>(() =>
     {
         var map = EntityTypeDataFactory.GetEntityTypeData <AddressInvalidProperty>();
     });
 }
예제 #3
0
        public void GetEntityTypeData_IgnorePropertyMap()
        {
            // Arrange & Act
            var map = EntityTypeDataFactory.GetEntityTypeData <AddressIgnoreProperties>();

            // Assert
            Assert.NotNull(map.NameChanges);
            Assert.Equal(2, map.NameChanges.Count);
            Assert.Equal("PartitionKey", map.NameChanges["Country"]);
            Assert.Equal("RowKey", map.NameChanges["Street"]);

            var entity = (DynamicTableEntity)map.GetEntity(new AddressIgnoreProperties());

            Assert.Equal(8, entity.Properties.Count);
        }
        public void CreateEntityTypeDataWithFactory()
        {
            // Arrange & Act
            IEntityTypeData <Country> entityTypeData = EntityTypeDataFactory.GetEntityTypeData <Country>();

            // Assert
            Assert.NotNull(entityTypeData);

            // Check name changes
            Assert.NotNull(entityTypeData.NameChanges);

            Assert.True(entityTypeData.NameChanges.ContainsKey("Continent"));
            Assert.Equal(entityTypeData.NameChanges["Continent"], "PartitionKey");
            Assert.True(entityTypeData.NameChanges.ContainsKey("Continent"));
            Assert.Equal(entityTypeData.NameChanges["Name"], "RowKey");
        }
예제 #5
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 public TableEntityConverter()
 {
     _typeData = EntityTypeDataFactory.GetEntityTypeData <T>();
 }