コード例 #1
0
        public void ConstructedWithEmptyDictionaryVerifyGettersReturnValues()
        {
            wlbPool = new WlbPoolConfiguration(new Dictionary <string, string>());
            PropertyInfo[] pi = wlbPool.GetType().GetProperties();

            Assert.AreEqual(NUMBER_OF_PROPERTIES, pi.Length, "Number of properties");

            List <string> fieldsToSkip = new List <string>()
            {
                "AutoBalanceAggressiveness",                              //Enum
                "AutoBalanceSeverity",                                    //Enum
                "ReportingSMTPServer"                                     //Not set
            };

            foreach (PropertyInfo propertyInfo in pi)
            {
                if (!fieldsToSkip.Contains(propertyInfo.Name))
                {
                    string extractedValue = propertyInfo.GetValue(wlbPool, null).ToString();
                    Assert.IsFalse(String.IsNullOrEmpty(extractedValue), "PB:" + propertyInfo.Name);
                }
            }

            Assert.IsNullOrEmpty(wlbPool.ReportingSMTPServer);
        }
コード例 #2
0
        public void ConstructedWithEmptyDictionaryVerifyGettersReturnValues()
        {
            wlbPool = new WlbPoolConfiguration(new Dictionary <string, string>());
            PropertyInfo[] pi = wlbPool.GetType().GetProperties();

            Assert.AreEqual(NUMBER_OF_PROPERTIES, pi.Length, "Number of properties");

            List <string> fieldsToSkip = new List <string>
            {
                "AutoBalanceAggressiveness", //Enum
                "AutoBalanceSeverity",       //Enum
                "ReportingSMTPServer",       //Not set
                "PoolAuditGranularity"       //Enum
            };

            foreach (PropertyInfo propertyInfo in pi)
            {
                if (!fieldsToSkip.Contains(propertyInfo.Name))
                {
                    string extractedValue = propertyInfo.GetValue(wlbPool, null).ToString();
                    Assert.That(extractedValue, Is.Not.Null.And.Not.Empty, $"PB: {propertyInfo.Name}");
                }
            }

            Assert.That(wlbPool.ReportingSMTPServer, Is.Null.Or.Empty);
        }