コード例 #1
0
        public void 移除SafeDictionary指定鍵值對_移除成功_字典內不應包含該鍵值且回傳True()
        {
            var safeDictionary = new SafeDictionary <int, int>
            {
                { 1, 3 },
                { 2, 8 }
            };
            var        pair           = new KeyValuePair <int, int>(2, 8);
            var        isSuccessful   = ((ICollection <KeyValuePair <int, int> >)safeDictionary).Remove(pair);
            const bool expectedResult = true;

            isSuccessful.Should().Be(expectedResult);
            var        isContainsKey     = safeDictionary.Contains(pair);
            const bool expectedIsContain = false;

            isContainsKey.Should().Be(expectedIsContain);
        }