Ejemplo n.º 1
0
        public void UpdateRuleAttributes_ShouldUpdateRule()
        {
            var dataStore = RCTestUtils.GetDataStore();

            dataStore.rulesList = new List <RuleWithSettingsMetadata>(RCTestUtils.rulesWithSettingsMetadata);
            RemoteConfigDataManager dataManager = new RemoteConfigDataManager();

            dataManager.UpdateRuleAttributes(RCTestUtils.ruleOneId, RCTestUtils.updatedRuleOne);
            Assert.That(dataStore.rulesList.Contains(RCTestUtils.updatedRuleOne));
            Assert.That(!dataStore.rulesList.Contains(RCTestUtils.rulesWithSettingsMetadata[0]));
            var ruleFromList = dataStore.rulesList.Find(r => r.id == RCTestUtils.updatedRuleOne.id);

            Assert.That(ruleFromList.enabled == RCTestUtils.updatedRuleOne.enabled);
            Assert.That(string.Equals(ruleFromList.condition, RCTestUtils.updatedRuleOne.condition));
            Assert.That(string.Equals(ruleFromList.name, RCTestUtils.updatedRuleOne.name));
            Assert.That(ruleFromList.rolloutPercentage == RCTestUtils.updatedRuleOne.rolloutPercentage);
        }