Пример #1
0
        public void SetRulesDataStore_SetsCorrectEntityIdOnSettingsInRule()
        {
            var dataStore = RCTestUtils.GetDataStore();
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();
            var config = new RemoteConfigConfigData()
            {
                type  = "settings",
                id    = "someId",
                value = RCTestUtils.rsListWihtoutMetadata
            };

            dataManager.SetRSDataStore(config);
            dataManager.SetRulesDataStore(RCTestUtils.rulesList);

            Assert.That(RuleListsAreEqual(dataStore.rulesList, RCTestUtils.rulesList));
            var rulesFromDataStore    = dataStore.rulesList;
            var settingsFromDataStore = dataStore.rsKeyList;

            for (int i = 0; i < rulesFromDataStore.Count; i++)
            {
                for (int j = 0; j < rulesFromDataStore[i].value.Count; i++)
                {
                    Assert.That(settingsFromDataStore.Contains(rulesFromDataStore[i].value[j]));
                }
            }
        }
Пример #2
0
        public void SetRulesDataStore_SetsRulesStoreWhenAListIsPassedInWithSettings()
        {
            var dataStore = RCTestUtils.GetDataStore();
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();

            dataManager.SetRulesDataStore(RCTestUtils.rulesWithSettingsList);

            Assert.That(RuleListsAreEqual(dataStore.rulesList, RCTestUtils.rulesWithSettingsList));
        }
Пример #3
0
        public void GetRulesList_ReturnsRulesList()
        {
            var dataStore = RCTestUtils.GetDataStore();
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();

            dataManager.SetRulesDataStore(new List <Rule>(RCTestUtils.rulesList));

            Assert.That(Equals(dataManager.GetRulesList(), dataStore.rulesList));
        }
Пример #4
0
        public void GetRuleByID_ReturnsRuleWithGivenID()
        {
            var dataStore = RCTestUtils.GetDataStore();
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();

            dataManager.SetRulesDataStore(new List <Rule>(RCTestUtils.rulesList));

            for (int i = 0; i < dataStore.rulesList.Count; i++)
            {
                Assert.That(Equals(dataManager.GetRuleByID(dataStore.rulesList[i].id), dataStore.rulesList[i]));
            }
        }
Пример #5
0
        public void SetRulesDataStore_SetsEntityIdOnKeys()
        {
            var dataStore = RCTestUtils.GetDataStore();
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();

            dataManager.SetRulesDataStore(new List <Rule>(RCTestUtils.rulesList));

            var rulesList = dataManager.GetRulesList();

            foreach (var rule in rulesList)
            {
                foreach (var setting in rule.value)
                {
                    Assert.That(RCTestUtils.rsDictWithMetadata.TryGetValue(setting.metadata.entityId, out RsKvtData rsKvt));
                }
            }

            Assert.That(Equals(dataManager.GetRulesList(), dataStore.rulesList));
        }