Example #1
0
        public void ReturnsNameOfKeyAtIndex_When_KeyExistsInStore()
        {
            // Arrange
            const string key1 = "TestKey1";
            const string key2 = "TestKey2";

            var item1 = new TestObject(1, "Jane Smith");
            var item2 = new TestObject(2, "John Smith");

            _sut.SetItem(key1, item1);
            _sut.SetItem(key2, item2);

            // Act
            var keyName = _sut.Key(1);

            // Assert
            Assert.Equal(key2, keyName);
        }
Example #2
0
        public async Task <IEnumerable <string> > GetKeys()
        {
            var length = LocalStorageService.Length();

            var keys = new List <string>();

            for (int i = 0; i < length; i++)
            {
                keys.Add(LocalStorageService.Key(i));
            }

            return(await Task.FromResult(keys));
        }