public void Convert_IfOtherPropertyIsIndexer_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <TableEntity, PocoWithIndexerOtherProperty> product =
                CreateProductUnderTest <PocoWithIndexerOtherProperty>();
            TableEntity entity = new TableEntity
            {
                PartitionKey      = expectedPartitionKey,
                ["OtherProperty"] = 456
            };
            // Act
            PocoWithIndexerOtherProperty actual = product.Convert(entity);

            // Assert
            Assert.NotNull(actual);
            Assert.AreSame(expectedPartitionKey, actual.PartitionKey);
        }
        public void Convert_IfOtherPropertyIsIndexer_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <PocoWithIndexerOtherProperty, TableEntity> product =
                CreateProductUnderTest <PocoWithIndexerOtherProperty>();
            PocoWithIndexerOtherProperty input = new PocoWithIndexerOtherProperty
            {
                PartitionKey = expectedPartitionKey
            };
            // Act
            TableEntity actual = product.Convert(input);

            // Assert
            Assert.NotNull(actual);
            Assert.NotNull(actual);
            Assert.False(actual.ContainsKey("OtherProperty"));
            Assert.AreSame(expectedPartitionKey, actual.PartitionKey);
        }
Ejemplo n.º 3
0
        public void Convert_IfOtherPropertyIsIndexer_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <ITableEntity, PocoWithIndexerOtherProperty> product =
                CreateProductUnderTest <PocoWithIndexerOtherProperty>();
            DynamicTableEntity entity = new DynamicTableEntity
            {
                PartitionKey = expectedPartitionKey,
                Properties   = new Dictionary <string, EntityProperty>
                {
                    { "OtherProperty", new EntityProperty(456) }
                }
            };

            // Act
            PocoWithIndexerOtherProperty actual = product.Convert(entity);

            // Assert
            Assert.NotNull(actual);
            Assert.Same(expectedPartitionKey, actual.PartitionKey);
        }
        public void Convert_IfOtherPropertyIsIndexer_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <PocoWithIndexerOtherProperty, ITableEntity> product =
                CreateProductUnderTest <PocoWithIndexerOtherProperty>();
            PocoWithIndexerOtherProperty input = new PocoWithIndexerOtherProperty
            {
                PartitionKey = expectedPartitionKey
            };

            // Act
            ITableEntity actual = product.Convert(input);

            // Assert
            Assert.NotNull(actual);
            IDictionary <string, EntityProperty> properties = actual.WriteEntity(operationContext: null);

            Assert.NotNull(properties);
            Assert.False(properties.ContainsKey("OtherProperty"));
            Assert.Same(expectedPartitionKey, actual.PartitionKey);
        }