Esempio n. 1
0
        public void Add()
        {
            IApiKeyService service = GetService();

            service.Add(_appId2, _secretKey2);
            Assert.Equal(2, service.Count);
            Assert.Equal(_secretKey2, service[_appId2]);
        }
Esempio n. 2
0
        public void Contains()
        {
            IApiKeyService service             = GetService();
            KeyValuePair <string, string> item = new KeyValuePair <string, string>(_appId2, _secretKey2);

            Assert.DoesNotContain(item, service);
            service.Add(item);
            Assert.Contains(item, service);
        }
Esempio n. 3
0
        public void AddKvp()
        {
            IApiKeyService service             = GetService();
            KeyValuePair <string, string> item = new KeyValuePair <string, string>(_appId2, _secretKey2);

            service.Add(item);
            string result = service[_appId2];

            Assert.Equal(_secretKey2, result);
        }
Esempio n. 4
0
        public void TryGetValue()
        {
            IApiKeyService service = GetService();
            string         result;

            Assert.False(service.TryGetValue(_appId2, out result));

            service.Add(_appId2, _secretKey2);
            bool success = service.TryGetValue(_appId2, out result);

            Assert.True(success);
            Assert.Equal(_secretKey2, result);
        }
Esempio n. 5
0
        public void RemoveKvp()
        {
            IApiKeyService service = GetService();

            service.Clear();
            KeyValuePair <string, string> item = new KeyValuePair <string, string>(_appId2, _secretKey2);
            bool succeded = service.Remove(item);

            Assert.False(succeded);

            service.Add(item);
            string result = service[_appId2];

            Assert.Equal(_secretKey2, result);
            succeded = service.Remove(item);
            Assert.True(succeded);
            Assert.Empty(service);
        }