private static PocoToTableEntityConverter <TInput> CreateProductUnderTest <TInput>()
        {
            var product = new PocoToTableEntityConverter <TInput>();

            Assert.NotNull(product); // Guard
            return(product);
        }
 public void Create_IfTimestampIsNonDateTimeOffset_Throws()
 {
     // Act & Assert
     ExceptionAssert.ThrowsInvalidOperation(
         () => PocoToTableEntityConverter <PocoWithNonDateTimeOffsetTimestamp> .Create(),
         "If the Timestamp property is present, it must be a DateTimeOffset.");
 }
 public void Create_IfPartitionKeyHasIndexParameters_Throws()
 {
     // Act & Assert
     ExceptionAssert.ThrowsInvalidOperation(
         () => PocoToTableEntityConverter <PocoWithIndexerPartitionKey> .Create(),
         "If the PartitionKey property is present, it must not be an indexer.");
 }
 public void Create_IfPartitionKeyIsNonString_Throws()
 {
     // Act & Assert
     ExceptionAssert.ThrowsInvalidOperation(
         () => PocoToTableEntityConverter <PocoWithNonStringPartitionKey> .Create(),
         "If the PartitionKey property is present, it must be a String.");
 }
        public void Create_ReturnsInstance()
        {
            // Act
            IConverter <Poco, TableEntity> converter = new PocoToTableEntityConverter <Poco>();

            // Assert
            Assert.NotNull(converter);
        }
        public void ConvertsETag_IfPocoDoesNotHaveETagProperty_ReturnsFalse()
        {
            // Arrange
            PocoToTableEntityConverter <Poco> product = CreateProductUnderTest <Poco>();
            // Act
            bool convertsETag = product.ConvertsETag;

            // Assert
            Assert.False(convertsETag);
        }
        public void ConvertsETag_IfPocoHasETagProperty_ReturnsTrue()
        {
            // Arrange
            PocoToTableEntityConverter <PocoWithETag> product = CreateProductUnderTest <PocoWithETag>();
            // Act
            bool convertsETag = product.ConvertsETag;

            // Assert
            Assert.True(convertsETag);
        }
        public void ConvertsRowKey_IfPocoHasRowKeyProperty_ReturnsTrue()
        {
            // Arrange
            PocoToTableEntityConverter <PocoWithRowKey> product = CreateProductUnderTest <PocoWithRowKey>();
            // Act
            bool convertsRowKey = product.ConvertsRowKey;

            // Assert
            Assert.True(convertsRowKey);
        }
        public void ConvertsPartitionKey_IfPocoDoesNotHavePartitionKeyProperty_ReturnsFalse()
        {
            // Arrange
            PocoToTableEntityConverter <Poco> product = CreateProductUnderTest <Poco>();
            // Act
            bool convertsPartitionKey = product.ConvertsPartitionKey;

            // Assert
            Assert.False(convertsPartitionKey);
        }
Beispiel #10
0
        public void Convert_IfInputIsNull_ReturnsNull()
        {
            // Arrange
            PocoToTableEntityConverter <Poco> product = CreateProductUnderTest <Poco>();
            Poco input = null;
            // Act
            TableEntity actual = product.Convert(input);

            // Assert
            Assert.Null(actual);
        }