Exemple #1
0
        public async void ShouldAddNewConfig()
        {
            KvpConfig config = new KvpConfig()
            {
                Value   = "Test",
                Name    = "Test",
                Type    = "String",
                Version = "1.0.0"
            };
            await _service.AddConfigSetting(config);

            var dict = await _service.StateManager.GetOrAddAsync <IReliableDictionary <ConfigKey, KvpConfig> >(CoreService.KvpDictionaryName);

            if (await dict.GetCountAsync(new MockTransaction()) != 1)
            {
                Assert.False(true, "The config key was not saved. The test will not proceed");
            }
            var val = await _service.GetConfigSetting(new ConfigKey("Test", "1.0.0"));

            Assert.True(val.Name == config.Name, "The config value saved was not equal to that passed into the service");
            Assert.True(val.Version == config.Version, "The config value saved was not equal to that passed into the service");
            Assert.True(val.Type == config.Type, "The config value saved was not equal to that passed into the service");
            Assert.True(val.Value == config.Value, "The config value saved was not equal to that passed into the service");
        }