public void Convert_PopulatesRowKey()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <PocoWithRowKey, TableEntity> product = CreateProductUnderTest <PocoWithRowKey>();
            PocoWithRowKey input = new PocoWithRowKey
            {
                RowKey = expectedRowKey
            };
            // Act
            TableEntity actual = product.Convert(input);

            // Assert
            Assert.NotNull(actual);
            Assert.AreSame(expectedRowKey, actual.RowKey);
        }
Beispiel #2
0
        public void Convert_PopulatesRowKey()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <ITableEntity, PocoWithRowKey> product = CreateProductUnderTest <PocoWithRowKey>();
            DynamicTableEntity entity = new DynamicTableEntity
            {
                RowKey = expectedRowKey
            };

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

            // Assert
            Assert.NotNull(actual);
            Assert.Same(expectedRowKey, actual.RowKey);
        }
        public void Convert_IfDictionaryContainsRowKey_PopulatesFromOfficialRowKey()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <TableEntity, PocoWithRowKey> product = CreateProductUnderTest <PocoWithRowKey>();
            TableEntity entity = new TableEntity
            {
                RowKey     = expectedRowKey,
                ["RowKey"] = "UnexpectedRK"
            };
            // Act
            PocoWithRowKey actual = product.Convert(entity);

            // Assert
            Assert.NotNull(actual);
            Assert.AreSame(expectedRowKey, actual.RowKey);
        }
        public void Convert_DoesNotIncludeRowKeyInDictionary()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <PocoWithRowKey, TableEntity> product = CreateProductUnderTest <PocoWithRowKey>();
            PocoWithRowKey input = new PocoWithRowKey
            {
                RowKey = expectedRowKey
            };
            // Act
            TableEntity actual = product.Convert(input);

            // Assert
            Assert.NotNull(actual);
            Assert.AreSame(expectedRowKey, actual.RowKey);
            Assert.NotNull(actual);
            Assert.False(actual.ContainsKey("RowKey"));
        }
Beispiel #5
0
        public void Convert_IfDictionaryContainsRowKey_PopulatesFromOfficialRowKey()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <ITableEntity, PocoWithRowKey> product = CreateProductUnderTest <PocoWithRowKey>();
            DynamicTableEntity entity = new DynamicTableEntity
            {
                RowKey     = expectedRowKey,
                Properties = new Dictionary <string, EntityProperty>
                {
                    { "RowKey", new EntityProperty("UnexpectedRK") }
                }
            };

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

            // Assert
            Assert.NotNull(actual);
            Assert.Same(expectedRowKey, actual.RowKey);
        }
        public void Convert_DoesNotIncludeRowKeyInDictionary()
        {
            // Arrange
            const string expectedRowKey = "RK";
            IConverter <PocoWithRowKey, ITableEntity> product = CreateProductUnderTest <PocoWithRowKey>();
            PocoWithRowKey input = new PocoWithRowKey
            {
                RowKey = expectedRowKey
            };

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

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

            Assert.NotNull(properties);
            Assert.False(properties.ContainsKey("RowKey"));
        }