public void MedicalInformation_VerifyNumberOfProperties()
        {
            var obj = new MedicalInformation();

            var result = obj.GetType()
                         .GetProperties()
                         .Count();

            Assert.AreEqual(10, result);
        }
        public void MedicalInformation_ShouldImplement_IDbModelInteface()
        {
            var obj = new MedicalInformation();

            var result = obj.GetType()
                         .GetInterfaces()
                         .Where(x => x == typeof(IDbModel))
                         .Any();

            Assert.IsTrue(result);
        }
        public void MedicalInformation_VerifyNumberOfConstructors()
        {
            var obj = new MedicalInformation();

            var methodsCount = obj.GetType()
                               .GetMethods()
                               .Count();

            var propertiesCount = obj.GetType()
                                  .GetProperties()
                                  .Count();

            var result = obj.GetType()
                         .GetMembers()
                         .Count();

            result = result - propertiesCount - methodsCount;

            Assert.AreEqual(1, result);
        }
        public void WaistSizeInCm_ShouldHave_RangeAttribute()
        {
            var obj = new MedicalInformation();

            var result = obj.GetType()
                         .GetProperty("WaistSizeInCm")
                         .GetCustomAttributes(false)
                         .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.RangeAttribute))
                         .Any();

            Assert.IsTrue(result);
        }
        public void Id_ShouldHave_KeyAttribute()
        {
            var obj = new MedicalInformation();

            var result = obj.GetType()
                         .GetProperty("Id")
                         .GetCustomAttributes(false)
                         .Where(x => x.GetType() == typeof(KeyAttribute))
                         .Any();

            Assert.IsTrue(result);
        }
        public void MedicalInformation_VerifyNumberOfMethods()
        {
            var methodsFromFramework = 4;
            var expectedMethodsCount = 0;
            var totalMethodsCount    = methodsFromFramework + expectedMethodsCount;

            var obj = new MedicalInformation();

            var numberOfMethodsComeFromProperties = obj.GetType()
                                                    .GetProperties()
                                                    .Select(x => 2)
                                                    .Sum();

            var result = obj.GetType()
                         .GetMethods()
                         .Count();

            result = result - numberOfMethodsComeFromProperties;

            Assert.AreEqual(totalMethodsCount, result);
        }
        public void WaistSizeInCm_ShouldHave_RightMaxValueFor_RangeAttribute()
        {
            var obj = new MedicalInformation();

            var result = obj.GetType()
                         .GetProperty("WaistSizeInCm")
                         .GetCustomAttributes(false)
                         .Where(x => x.GetType() == typeof(System.ComponentModel.DataAnnotations.RangeAttribute))
                         .Select(x => (System.ComponentModel.DataAnnotations.RangeAttribute)x)
                         .SingleOrDefault();

            Assert.IsNotNull(result);
            Assert.AreEqual(ValidationConstants.WaistSizeMaxValue, result.Maximum);
        }