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

            // Act & Assert
            Assert.ThrowsArgumentNull(() => property.AsDate(), "property");
        }
        public void AsDate_ThrowsArgument(Type propertyType)
        {
            // Arrange
            MockType type = new MockType().Property(propertyType, "Birthday");
            PropertyInfo property = type.GetProperty("Birthday");
            _structuralType.Setup(t => t.ClrType).Returns(type);

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

            // Assert
            Assert.ThrowsArgument(() => propertyConfig.AsDate(), "property",
                "The property 'Birthday' on type 'NS.Customer' must be a System.DateTime property");
        }
Exemplo n.º 3
0
        public void AsDate_ThrowsArgument(Type propertyType)
        {
            // Arrange
            MockType     type     = new MockType().Property(propertyType, "Birthday");
            PropertyInfo property = type.GetProperty("Birthday");

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

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

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

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

            // Assert
            Assert.NotNull(typeKind);
            Assert.Equal(EdmPrimitiveTypeKind.Date, typeKind);
        }
Exemplo n.º 5
0
        public void AsDate_Works()
        {
            // Arrange
            MockType     type     = new MockType().Property(typeof(DateTime), "Birthday");
            PropertyInfo property = type.GetProperty("Birthday");

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

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

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