Exemplo n.º 1
0
        public void PrimaryKeyAttributeShouldNotBePresent()
        {
            // Create a new instance of MappedDataType
            var mappedDataType = new MappedDataType();

            // Gets a property decorated with the attribute
            var property = mappedDataType.GetType().GetProperty("Description");

            Assert.IsNotNull(property);

            // Gets all the attributes of the property
            var attributes = property.GetCustomAttributes(false);

            foreach (var attribute in attributes)
            {
                if (attribute != null)
                {
                    Assert.IsNotInstanceOfType(attributes[0], typeof(IsPrimaryKeyAttribute));
                }
            }
        }
Exemplo n.º 2
0
        public void PrimaryKeyShouldNotBeTrue()
        {
            // Create a new instance of MappedDataType
            var mappedDataType = new MappedDataType();

            // Gets a property decorated with the attribute
            var property = mappedDataType.GetType().GetProperty("Text");

            Assert.IsNotNull(property);

            // Gets all the attributes of the property
            var attributes = property.GetCustomAttributes(false);

            Assert.IsNotNull(attributes);

            Assert.AreEqual(1, attributes.Length);

            Assert.IsNotNull(attributes[0]);

            Assert.IsInstanceOfType(attributes[0], typeof(IsPrimaryKeyAttribute));

            Assert.AreEqual(false, ((IsPrimaryKeyAttribute)attributes[0]).Value);
        }