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

            _sut.Clear();

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

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

            // Act
            var keyNames = _sut.KeysAsync().Result.ToList();

            // Assert
            Assert.Collection(keyNames,
                              item => Assert.Equal(key1, item),
                              item => Assert.Equal(key2, item));
        }