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

            // Assert
            Assert.NotNull(actual);
            Assert.Null(PocoWithStaticOtherProperty.OtherProperty);
            Assert.AreSame(expectedPartitionKey, actual.PartitionKey);
        }
        public void Convert_IfOtherPropertyIsStatic_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <PocoWithStaticOtherProperty, TableEntity> product =
                CreateProductUnderTest <PocoWithStaticOtherProperty>();

            PocoWithStaticOtherProperty.OtherProperty = 456;
            PocoWithStaticOtherProperty input = new PocoWithStaticOtherProperty
            {
                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);
        }
Example #3
0
        public void Convert_IfOtherPropertyIsStatic_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <ITableEntity, PocoWithStaticOtherProperty> product =
                CreateProductUnderTest <PocoWithStaticOtherProperty>();
            DynamicTableEntity entity = new DynamicTableEntity
            {
                PartitionKey = expectedPartitionKey,
                Properties   = new Dictionary <string, EntityProperty>
                {
                    { "OtherProperty", new EntityProperty(456) }
                }
            };

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

            // Assert
            Assert.NotNull(actual);
            Assert.Null(PocoWithStaticOtherProperty.OtherProperty);
            Assert.Same(expectedPartitionKey, actual.PartitionKey);
        }
        public void Convert_IfOtherPropertyIsStatic_Ignores()
        {
            // Arrange
            const string expectedPartitionKey = "PK";
            IConverter <PocoWithStaticOtherProperty, ITableEntity> product =
                CreateProductUnderTest <PocoWithStaticOtherProperty>();

            PocoWithStaticOtherProperty.OtherProperty = 456;
            PocoWithStaticOtherProperty input = new PocoWithStaticOtherProperty
            {
                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);
        }