Ejemplo n.º 1
0
        public void AsTimeOfDay_ThrowsArgumentNull()
        {
            // Arrange
            PrimitivePropertyConfiguration property = null;

            // Act & Assert
            Assert.ThrowsArgumentNull(() => property.AsTimeOfDay(), "property");
        }
Ejemplo n.º 2
0
        public void AsTimeOfDay_ThrowsArgument(Type propertyType)
        {
            // Arrange
            MockType     type     = new MockType().Property(propertyType, "CreatedTime");
            PropertyInfo property = type.GetProperty("CreatedTime");

            _structuralType.Setup(t => t.ClrType).Returns(type);

            // Act
            PrimitivePropertyConfiguration propertyConfig = new PrimitivePropertyConfiguration(property, _structuralType.Object);

            // Assert
            Assert.ThrowsArgument(() => propertyConfig.AsTimeOfDay(), "property",
                                  "The property 'CreatedTime' on type 'NS.Customer' must be a System.TimeSpan property");
        }
Ejemplo n.º 3
0
        public void AsTimeOfDay_Works()
        {
            // Arrange
            MockType     type     = new MockType().Property(typeof(TimeSpan), "CreatedTime");
            PropertyInfo property = type.GetProperty("CreatedTime");

            _structuralType.Setup(t => t.ClrType).Returns(type);

            // Act
            PrimitivePropertyConfiguration propertyConfig = new PrimitivePropertyConfiguration(property, _structuralType.Object);
            EdmPrimitiveTypeKind?          typeKind       = propertyConfig.AsTimeOfDay().TargetEdmTypeKind;

            // Assert
            Assert.NotNull(typeKind);
            Assert.Equal(EdmPrimitiveTypeKind.TimeOfDay, typeKind);
        }
        public void AsTimeOfDay_ThrowsArgument(Type propertyType)
        {
            // Arrange
            MockType type = new MockType().Property(propertyType, "CreatedTime");
            PropertyInfo property = type.GetProperty("CreatedTime");
            _structuralType.Setup(t => t.ClrType).Returns(type);

            // Act
            PrimitivePropertyConfiguration propertyConfig = new PrimitivePropertyConfiguration(property, _structuralType.Object);

            // Assert
            Assert.ThrowsArgument(() => propertyConfig.AsTimeOfDay(), "property",
                "The property 'CreatedTime' on type 'NS.Customer' must be a System.TimeSpan property");
        }
        public void AsTimeOfDay_Works()
        {
            // Arrange
            MockType type = new MockType().Property(typeof(TimeSpan), "CreatedTime");
            PropertyInfo property = type.GetProperty("CreatedTime");
            _structuralType.Setup(t => t.ClrType).Returns(type);

            // Act
            PrimitivePropertyConfiguration propertyConfig = new PrimitivePropertyConfiguration(property, _structuralType.Object);
            EdmPrimitiveTypeKind? typeKind = propertyConfig.AsTimeOfDay().TargetEdmTypeKind;

            // Assert
            Assert.NotNull(typeKind);
            Assert.Equal(EdmPrimitiveTypeKind.TimeOfDay, typeKind);
        }