コード例 #1
0
 public void BadSettingPUT3([PexAssumeUnderTest]SettingsGroup testGroup1, [PexAssumeUnderTest]String settingName, [PexAssumeUnderTest]Object settingValue, bool defSettingValue)
 {
     PexAssume.IsTrue(settingName != null);
     PexAssume.IsTrue(settingValue != null);
     //PexAssume.IsTrue(defSettingValue != null);
     PexAssume.IsTrue(settingValue is string);
     PexAssume.IsTrue(!settingValue.Equals("True") && !settingValue.Equals("False"));
     DelegateHandler dhObj1 = new DelegateHandler(testGroup1);
     testGroup1.SaveSetting(settingName, settingValue);
     PexAssert.AreEqual(defSettingValue, testGroup1.GetSetting(settingName, defSettingValue));
 }
コード例 #2
0
        public void BadSettingPUT4([PexAssumeUnderTest]String settingName, [PexAssumeUnderTest]Object settingValue, [PexAssumeUnderTest]Object defSettingValue)
        {
            PexAssume.IsTrue(settingName != null);
            PexAssume.IsTrue(settingValue != null);
            PexAssume.IsTrue(defSettingValue != null);

            SettingsGroup testGroup1 = new SettingsGroup(new MemorySettingsStorage());
            DelegateHandler dhObj1 = new DelegateHandler(testGroup1);
            if (defSettingValue is object)
            {
                PexAssert.AreEqual(defSettingValue, testGroup1.GetSetting(settingName, defSettingValue));
            }
            if (settingValue is String && defSettingValue is int)
            {
                PexAssert.AreEqual(defSettingValue, testGroup1.GetSetting(settingName, defSettingValue));
            }
        }
コード例 #3
0
 public void TopLevelSettingsPUT3([PexAssumeUnderTest]SettingsGroup testGroup1, [PexAssumeUnderTest]
     String settingName, [PexAssumeUnderTest]Object settingValue)
 {
     PexAssume.IsTrue(settingName != null);
     PexAssume.IsTrue(settingValue != null);
     DelegateHandler dhObj = new DelegateHandler(testGroup1);
     PexAssume.IsTrue(testGroup1.GetSetting(settingName) != null);
     testGroup1.SaveSetting(settingName, testGroup1.GetSetting(settingName));
     testGroup1.RemoveSetting(settingName);
     PexAssume.IsNull(testGroup1.GetSetting(settingName));
 }
コード例 #4
0
        public void SubGroupSettingsPUT3([PexAssumeUnderTest] SettingsGroup testGroup1, [PexAssumeUnderTest]
            String settingName, [PexAssumeUnderTest]Object settingValue)
        {
            PexAssume.IsTrue(settingName != null);
            PexAssume.IsTrue(settingValue != null);
            DelegateHandler dhObj1 = new DelegateHandler(testGroup1);
            SettingsGroup subGroup = new SettingsGroup(testGroup1.Storage);
            PexAssert.IsNotNull(subGroup);
            PexAssert.IsNotNull(subGroup.Storage);

            //Without delegate
            subGroup.SaveSetting(settingName, settingValue);
            PexAssert.AreEqual(settingValue, subGroup.GetSetting(settingName));
            subGroup.RemoveSetting(settingName);
            PexAssert.IsNull(subGroup.GetSetting(settingName));

            //With delegate
            DelegateHandler dhObj2 = new DelegateHandler(subGroup);
            subGroup.SaveSetting(settingName, settingValue);
            PexAssert.AreEqual(settingValue, subGroup.GetSetting(settingName));
            subGroup.RemoveSetting(settingName);
            PexAssert.IsNull(subGroup.GetSetting(settingName));
        }
コード例 #5
0
        public void BadSettingPUT6([PexAssumeUnderTest]String settingName, [PexAssumeUnderTest]Object settingValue, [PexAssumeUnderTest]Object defSettingValue)
        {
            PexAssume.IsTrue(settingName != null);
            PexAssume.IsTrue(settingValue != null && settingValue is String);

            String str_sv = settingValue.ToString();
            PexAssume.IsTrue(Regex.IsMatch(str_sv, "@([a-z])*"));
            PexAssume.IsTrue(defSettingValue != null);

            SettingsGroup testGroup1 = new SettingsGroup(new MemorySettingsStorage());
            DelegateHandler dhObj1 = new DelegateHandler(testGroup1);

            if (defSettingValue is int)
            {
                testGroup1.SaveSetting(settingName, settingValue);
                int defVal = Int32.Parse(defSettingValue.ToString());
                PexAssert.AreEqual(defVal, testGroup1.GetSetting(settingName, defVal));
            }
            else if (defSettingValue is string)
            {
                String defVal = defSettingValue.ToString();
                PexAssert.AreEqual(defVal, testGroup1.GetSetting(settingName, defVal));
            }
            else if (!settingValue.Equals("True") && !settingValue.Equals("False") && defSettingValue is bool)
            {
                bool defVal = Boolean.Parse(defSettingValue.ToString());
                PexAssert.AreEqual(defVal, testGroup1.GetSetting(settingName, defVal));
                testGroup1.SaveSetting(settingName, settingValue);
                PexAssert.AreEqual(defVal, testGroup1.GetSetting(settingName, defVal));
            }
        }
コード例 #6
0
        public void BadSettingPUT5([PexAssumeUnderTest]String settingName, [PexAssumeUnderTest]Object settingValue, [PexAssumeUnderTest]Object defSettingValue)
        {
            PexAssume.IsTrue(settingName != null);
            PexAssume.IsTrue(settingValue != null);
            PexAssume.IsTrue(defSettingValue != null && defSettingValue is String);
            PexAssume.IsTrue(settingValue is bool);

            SettingsGroup testGroup1 = new SettingsGroup(new MemorySettingsStorage());
            DelegateHandler dhObj1 = new DelegateHandler(testGroup1);
            testGroup1.SaveSetting(settingName, settingValue);
            String defSettingValue_typecast = defSettingValue as String;
            PexAssert.AreEqual(settingValue.ToString(), testGroup1.GetSetting(settingName, defSettingValue_typecast));
        }